Arsenal - Add magazineWell support (#6355)

* ACE Arsenal magazineWell support

* Fix case sensitivity problems
as
This commit is contained in:
Dedmen Miller 2018-06-01 03:46:48 +02:00 committed by PabstMirror
parent 0ae93aa2e7
commit f5cd682ce3
2 changed files with 25 additions and 17 deletions

View File

@ -80,15 +80,17 @@ private _compatibleMagazines = [[[], []], [[], []], [[], []]];
{
private _subIndex = _forEachIndex;
{
// Magazine group
if !(isClass (configFile >> "CfgMagazines" >> _x)) then {
private _magazineGroups = uiNamespace getVariable [QGVAR(magazineGroups),["#CBA_HASH#",[],[],[]]];
private _magArray = [_magazineGroups, _x] call CBA_fnc_hashGet;
{((_compatibleMagazines select _index) select _subIndex) pushBackUnique _x} forEach _magArray;
} else {
((_compatibleMagazines select _index) select _subIndex) pushBackUnique (configName (configFile >> "CfgMagazines" >> _x))
}
((_compatibleMagazines select _index) select _subIndex) pushBackUnique (configName (configFile >> "CfgMagazines" >> _x))
} foreach ([getArray (_weaponConfig >> _x >> "magazines"), getArray (_weaponConfig >> "magazines")] select (_x == "this"));
// Magazine groups
{
private _magazineGroups = uiNamespace getVariable [QGVAR(magazineGroups),["#CBA_HASH#",[],[],[]]];
private _magArray = [_magazineGroups, toLower _x] call CBA_fnc_hashGet;
{((_compatibleMagazines select _index) select _subIndex) pushBackUnique _x} forEach _magArray;
} foreach ([getArray (_weaponConfig >> _x >> "magazineWell"), getArray (_weaponConfig >> "magazineWell")] select (_x == "this"));
} foreach getArray (_weaponConfig >> "muzzles");
};
} foreach [primaryWeapon GVAR(center), handgunWeapon GVAR(center), secondaryWeapon GVAR(center)];

View File

@ -34,7 +34,6 @@ private _cargo = [
];
private _configCfgWeapons = configFile >> "CfgWeapons"; //Save this lookup in variable for perf improvement
private _magazineGroups = [[],[]] call CBA_fnc_hashCreate;
{
private _configItemInfo = _x >> "ItemInfo";
@ -158,14 +157,6 @@ private _putList = [];
(_cargo select 16) pushBackUnique _className;
};
};
if (isArray (_x >> "magazineGroup")) then {
{
private _entry = [_magazineGroups, _x] call CBA_fnc_hashGet;
_entry pushBackUnique _className;
[_magazineGroups, _x, _entry] call CBA_fnc_hashSet;
} forEach getArray (_x >> "magazineGroup")
};
} foreach configProperties [(configFile >> "CfgMagazines"), "isClass _x && {(if (isNumber (_x >> 'scopeArsenal')) then {getNumber (_x >> 'scopeArsenal')} else {getNumber (_x >> 'scope')}) == 2} && {getNumber (_x >> 'ace_arsenal_hide') != 1}", true];
{
@ -178,5 +169,20 @@ private _putList = [];
(_cargo select 7) pushBackUnique (configName _x);
} foreach configProperties [(configFile >> "CfgGlasses"), "isClass _x && {(if (isNumber (_x >> 'scopeArsenal')) then {getNumber (_x >> 'scopeArsenal')} else {getNumber (_x >> 'scope')}) == 2} && {getNumber (_x >> 'ace_arsenal_hide') != 1}", true];
private _magazineGroups = [[],[]] call CBA_fnc_hashCreate;
private _cfgMagazines = configFile >> "CfgMagazines";
{
private _magList = [];
{
private _magazines = (getArray _x) select {isClass (_cfgMagazines >> _x)}; //filter out non-existent magazines
_magazines = _magazines apply {configName (_cfgMagazines >> _x)}; //Make sure classname case is correct
_magList append _magazines;
} foreach configProperties [_x, "isArray _x", true];
[_magazineGroups, toLower configName _x, _magList arrayIntersect _magList] call CBA_fnc_hashSet;
} foreach configProperties [(configFile >> "CfgMagazineWells"), "isClass _x", true];
uiNamespace setVariable [QGVAR(configItems), _cargo];
uiNamespace setVariable [QGVAR(magazineGroups), _magazineGroups];