|
| 1 | +// ["vn_"] call compileScript ["\x\cba\addons\jam\dev_diagnoseMagWells.sqf"]; |
| 2 | + |
| 3 | +params ["_prefix"]; |
| 4 | +_prefix = toLower _prefix; |
| 5 | +private _prefixSize = count _prefix; |
| 6 | + |
| 7 | +private _cfgMagazines = configFile >> "CfgMagazines"; |
| 8 | +private _cfgMagazineWells = configFile >> "CfgMagazineWells"; |
| 9 | +private _weapons = "getNumber (_x >> 'scope') == 2" configClasses (configFile >> "CfgWeapons"); |
| 10 | +{ |
| 11 | + private _weaponConfig = _x; |
| 12 | + private _weapon = configName _weaponConfig; |
| 13 | + if ((_weapon select [0, _prefixSize]) != _prefix) then { continue }; |
| 14 | + |
| 15 | + { |
| 16 | + private _muzzle = _x; |
| 17 | + private _muzzleConfig = _weaponConfig; |
| 18 | + // diag_log text format ["%1 -> %2", _weapon, _muzzle]; |
| 19 | + if ((_muzzle != "this") && {_muzzle != _weapon}) then {_muzzleConfig = _weaponConfig >> _muzzle }; |
| 20 | + private _directMags = (getArray (_muzzleConfig >> "magazines")) apply {configName (configFile >> "CfgMagazines" >> _x)}; |
| 21 | + private _allMags = compatibleMagazines [_weapon, _muzzle]; |
| 22 | + private _cbaWellMags = []; |
| 23 | + { |
| 24 | + if ((_x select [0,3]) != "CBA") then { continue }; |
| 25 | + private _wellConfig = _cfgMagazineWells >> _x; |
| 26 | + { |
| 27 | + _cbaWellMags append getArray _x; |
| 28 | + } forEach configProperties [_wellConfig, "isArray _x", false]; |
| 29 | + } forEach (getArray (_muzzleConfig >> "magazineWell")); |
| 30 | + _cbaWellMags = _cbaWellMags select {isClass (_cfgMagazines >> _x)}; |
| 31 | + _cbaWellMags = _cbaWellMags apply {configName (_cfgMagazines >> _x)}; |
| 32 | + |
| 33 | + private _exlusiveCbaMags = _cbaWellMags - _directMags; |
| 34 | + if (_exlusiveCbaMags isEqualTo []) then { continue }; |
| 35 | + |
| 36 | + private _weaponDisplay = _weapon; |
| 37 | + if ((_muzzle != "this") && {_muzzle != _weapon}) then {_weaponDisplay = _weaponDisplay + format ["[%1]", _muzzle] }; |
| 38 | + diag_log text format ["%1 gained %2 mags through cba wells", _weaponDisplay, count _exlusiveCbaMags]; |
| 39 | + diag_log text format [" Mags %1", _exlusiveCbaMags]; |
| 40 | + diag_log text format [" Well %1", getArray (_muzzleConfig >> "magazineWell")]; |
| 41 | + } forEach getArray (_x >> "muzzles"); |
| 42 | +} forEach _weapons; |
0 commit comments