Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No armor or ballistic protection with new uniforms #14

Open
bijx opened this issue Jan 31, 2024 · 3 comments
Open

No armor or ballistic protection with new uniforms #14

bijx opened this issue Jan 31, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@bijx
Copy link
Owner

bijx commented Jan 31, 2024

According to a comment on YouTube:

One problem with the uniform mod is that it doesn't give armour ballistic or explosive protection, but I like it

Theoretically, the armor levels are not overridden, so they should not be different than the base game values. This should be tested however, and if necessary, the values should be reintroduced to the configuration files.

@bijx bijx added the bug Something isn't working label Jan 31, 2024
@GrogTWise
Copy link

Took me a while, but here's the files in question
Grogtopia - Copy.zip

@NixonMSilva
Copy link

NixonMSilva commented Mar 2, 2024

I tracked down the issue to the cfgWeaponsBuilder.js script.

When generating the config.cpp I added the information for the HitpointsProtectionInfo class for both vests and helmet. The end result file is as follows:

/**
 * Generates the cfgWeapons code block for a given className and addons.
 *
 * @param {string} className - The name of the class.
 * @param {string[]} addons - An array of addon names.
 * @returns {string} The generated cfgWeapons code block.
 */
module.exports = function cfgWeaponsBuilder(className, author, addons) {

  const addonsMappings = {
    baseUniform: `
    class ${className}_CamoBase: Uniform_Base 
    { 
        scope = 2;
        author = "${author}";
        displayName = "${className} Base Uniform";
        picture = "${className}\\UI\\icon.paa";
        model = "\\A3\\characters_f\\BLUFOR\\b_soldier_01.p3d"; 
        class ItemInfo : UniformItem { 
            uniformClass = "${className}_UniformBase"; 
            containerClass = "Supply50";
            mass = 50;
        }; 
    };
    `,
    indepUniform: `
    class ${className}_CamoIndep: Uniform_Base 
    { 
        scope = 2;
        author = "${author}";
        displayName = "${className} Indep Uniform";
        picture = "${className}\\UI\\icon.paa";
        model = "\\A3\\characters_f_beta\\INDEP\\ia_soldier_01.p3d"; 
        class ItemInfo : UniformItem { 
            uniformClass = "${className}_UniformIndep"; 
            containerClass = "Supply50";
            mass = 50;
        }; 
    };
    `,
    carrierRigSpecial: `
    class ${className}_CarrierRig_Special: Vest_Camo_Base
	{
		author="${author}";
		scope=2;
		displayName="${className} Special Carrier Rig";
		picture="${className}\\UI\\icon.paa";
		model="\\A3\\Characters_F\\BLUFOR\\equip_b_carrier_spec_rig.p3d";
		hiddenSelections[]=
		{
			"camo"
		};
		hiddenSelectionsTextures[]=
		{
			"${className}\\Data\\carrier_rig_special_co.paa"
		};
		class ItemInfo: VestItem
		{
			uniformModel="\\A3\\Characters_F\\BLUFOR\\equip_b_carrier_spec_rig.p3d";
			hiddenSelections[]=
			{
				"camo"
			};
			containerClass="Supply100";
			mass=120;
			
			class HitpointsProtectionInfo
			{
				class Neck
				{
					hitpointName	= "HitNeck";	// reference to the hit point class defined in the man base class
					armor			= 8;			// addition to armor of referenced hitpoint
					passThrough		= 0.5;			// multiplier of base passThrough defined in referenced hitpoint
				};
				class Arms
				{
					hitpointName	= "HitArms";
					armor			= 8;
					passThrough		= 0.5;
				};
				class Chest
				{
					hitpointName	= "HitChest";
					armor			= 24;
					passThrough		= 0.1;
				};
				class Diaphragm
				{
					hitpointName	= "HitDiaphragm";
					armor			= 24;
					passThrough		= 0.1;
				};
				class Abdomen
				{
					hitpointName	= "HitAbdomen";
					armor			= 24;
					passThrough		= 0.1;
				};
				class Body
				{
					hitpointName	= "HitBody";
					passThrough		= 0.1;
				};
			};
		};
	};    
    `,
    carrierRig: `
	class ${className}_CarrierRig: Vest_Camo_Base
	{
		author="${author}";
		scope=2;
		displayName="${className} Carrier Rig";
		picture="${className}\\UI\\icon.paa";
		model="\\A3\\Characters_F\\BLUFOR\\equip_b_vest02.p3d";
		hiddenSelections[]=
		{
			"camo"
		};
		hiddenSelectionsTextures[]=
		{
			"${className}\\Data\\carrier_rig_co.paa"
		};
		class ItemInfo: VestItem
		{
			uniformModel="\\A3\\Characters_F\\BLUFOR\\equip_b_vest02.p3d";
			hiddenSelections[]=
			{
				"camo"
			};
			containerClass="Supply140";
			mass=80;
			
			class HitpointsProtectionInfo
            {
                class Chest
                {
                    hitpointName="HitChest";
                    armor=20;
                    passThrough=0.2;
                };
                class Diaphragm
                {
                    hitpointName="HitDiaphragm";
                    armor=20;
                    passThrough=0.2;
                };
                class Abdomen
                {
                    hitpointName="HitAbdomen";
                    armor=20;
                    passThrough=0.2;
                };
                class Body
                {
                    hitpointName="HitBody";
                    passThrough=0.1;
                };
            };
		};
	};
    `,
    helmetBlufor: `
    class HeadgearItem;
    class H_HelmetB;
    class ${className}_HelmetBlufor: H_HelmetB
	{
		author="${author}";
		scope=2;
		displayName="${className} Combat Helmet";
		model="\\A3\\Characters_F\\BLUFOR\\headgear_b_helmet_plain.p3d";
		picture="${className}\\UI\\icon.paa";
		hiddenSelections[]=
		{
			"camo"
		};
		hiddenSelectionsTextures[]=
		{
			"${className}\\Data\\helmet_blufor_co.paa"
		};
		class ItemInfo: HeadgearItem
		{
			mass=30;
			uniformModel="\\A3\\Characters_F\\BLUFOR\\headgear_b_helmet_plain.p3d";
			hiddenSelections[]=
			{
				"camo"
			};
			
			class HitpointsProtectionInfo
            {
                class Head
                {
                    hitpointName="HitHead";
                    armor=6;
                    passThrough=0.5;
                };
            };
		};
	};
    `,
  };

  

  return `
  class cfgWeapons 
  { 
      class ItemCore; 
      class UniformItem; 
      class Uniform_Base: ItemCore 
      { 
          class ItemInfo; 
      };
      class VestItem;
      class Vest_Camo_Base: ItemCore
      {
          class ItemInfo;
      };
  
      ${addons.map(addon => addonsMappings[addon]).join('\n')}
  };`
}

After replacing the original file this should generate the modded equipment with the proper protection values.

@bijx
Copy link
Owner Author

bijx commented Mar 3, 2024

@NixonMSilva Great find! If you'd like to make a pull request I'd be happy to review and merge 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants