Files
A3Rebalancer/armor.sqf
T
Samuele Lorefice 83d2cb6c52 Initial commit: ArmADump ammo/armor rebalance tool
- SQF extraction scripts (ammo, armor, weapons, magazines) with ACE3 properties
- Python pipeline: extract_csvs, split_by_mod, generate_patches
- Generates CfgPatches config.cpp normalizing non-RHS values to RHS baseline
- Documentation: REFERENCE.md, GENERATE_PATCHES_EXPLAINED.md, AGENTS.md
2026-07-20 18:27:33 +02:00

124 lines
4.8 KiB
Plaintext

///////// ARMA3 Config CSV EXPORT — Armor (Vests + Headgear)
///////// Usage: execVM "armor.sqf" or paste execVM in debug console
///////// Arguments: [name, CfgPatches name] for a mod, [name] for vanilla BIS
///////// Outputs: CSV via diag_log to .rpt
private ["_CfgPatches","_configPath","_getClass","_out","_items","_count"];
_CfgPatches = false;
_configPath = "";
if(count _this > 1) then
{
_configPath = _configPath + (_this select 1);
_CfgPatches = true;
};
_getClass = {
_out = "";
if(typename _this == "STRING") then
{
_out = _this;
}
else
{
_out = configName _this;
};
_out;
};
_count = 0;
_items = [];
if(_CfgPatches) then
{
_items = _items + getArray(configfile >> "CfgPatches" >> _configPath >> "weapons");
}
else
{
_items = [configFile >> "CfgWeapons"] call BIS_fnc_returnChildren;
};
diag_log "--- ARMOR EXPORT CSV START ---";
diag_log text("source_mod;name;type;class_name;mass;armor_Head;armor_Neck;armor_Chest;armor_Diaphragm;armor_Abdomen;armor_Body;armor_Arms;armor_Legs;passthrough_Head;passthrough_Neck;passthrough_Chest;passthrough_Diaphragm;passthrough_Abdomen;passthrough_Body;passthrough_Arms;passthrough_Legs");
{
private _configName = _x call _getClass;
private _name = getText(configFile >> "CfgWeapons" >> _configName >> "displayname");
if (_name != "") then {
private _parents = [_x, true] call BIS_fnc_returnParents;
private _type = "";
// Only process Vest and HeadGear
if ("HelmetBase" in _parents || "H_HelmetB" in _parents) then { _type = "HeadGear"; };
if ("Vest_Camo_Base" in _parents || "Vest_NoCamo_Base" in _parents) then { _type = "Vest"; };
if (_type != "") then {
// Source mod
private _sources = configSourceAddonList (configFile >> "CfgWeapons" >> _configName);
private _sourceMod = "unknown";
if (count _sources > 0) then { _sourceMod = _sources select 0; };
private _mass = getNumber(configFile >> "CfgWeapons" >> _configName >> "ItemInfo" >> "mass");
// Extract per-body-part armor and passthrough
// Defaults: armor=0, passthrough=1 (no protection)
private _aH = 0; private _pH = 1;
private _aN = 0; private _pN = 1;
private _aC = 0; private _pC = 1;
private _aD = 0; private _pD = 1;
private _aAb = 0; private _pAb = 1;
private _aBo = 0; private _pBo = 1;
private _aAr = 0; private _pAr = 1;
private _aL = 0; private _pL = 1;
private _hppBase = configFile >> "CfgWeapons" >> _configName >> "ItemInfo" >> "HitpointsProtectionInfo";
if (isClass (_hppBase >> "Head")) then {
_aH = getNumber(_hppBase >> "Head" >> "armor");
_pH = getNumber(_hppBase >> "Head" >> "passThrough");
};
if (isClass (_hppBase >> "Neck")) then {
_aN = getNumber(_hppBase >> "Neck" >> "armor");
_pN = getNumber(_hppBase >> "Neck" >> "passThrough");
};
if (isClass (_hppBase >> "Chest")) then {
_aC = getNumber(_hppBase >> "Chest" >> "armor");
_pC = getNumber(_hppBase >> "Chest" >> "passThrough");
};
if (isClass (_hppBase >> "Diaphragm")) then {
_aD = getNumber(_hppBase >> "Diaphragm" >> "armor");
_pD = getNumber(_hppBase >> "Diaphragm" >> "passThrough");
};
if (isClass (_hppBase >> "Abdomen")) then {
_aAb = getNumber(_hppBase >> "Abdomen" >> "armor");
_pAb = getNumber(_hppBase >> "Abdomen" >> "passThrough");
};
if (isClass (_hppBase >> "Body")) then {
_aBo = getNumber(_hppBase >> "Body" >> "armor");
_pBo = getNumber(_hppBase >> "Body" >> "passThrough");
};
if (isClass (_hppBase >> "Arms")) then {
_aAr = getNumber(_hppBase >> "Arms" >> "armor");
_pAr = getNumber(_hppBase >> "Arms" >> "passThrough");
};
if (isClass (_hppBase >> "Legs")) then {
_aL = getNumber(_hppBase >> "Legs" >> "armor");
_pL = getNumber(_hppBase >> "Legs" >> "passThrough");
};
diag_log text(format["%1;%2;%3;%4;%5;%6;%7;%8;%9;%10;%11;%12;%13;%14;%15;%16;%17;%18;%19;%20;%21",
_sourceMod, _name, _type, _configName, _mass,
_aH, _aN, _aC, _aD, _aAb, _aBo, _aAr, _aL,
_pH, _pN, _pC, _pD, _pAb, _pBo, _pAr, _pL]);
_count = _count + 1;
if (_count % 100 == 0) then { sleep 0; };
};
};
} forEach _items;
diag_log "--- ARMOR EXPORT CSV END ---";
systemchat format["Armor export done — %1 items", _count];