Skip to content

Commit

Permalink
Arsenal - Add magazineWell support (#6355)
Browse files Browse the repository at this point in the history
* ACE Arsenal magazineWell support

* Fix case sensitivity problems
as
  • Loading branch information
dedmen authored and PabstMirror committed Jun 1, 2018
1 parent 5e927cc commit 3ff3b25
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
18 changes: 10 additions & 8 deletions addons/arsenal/functions/fnc_fillRightPanel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
Expand Down
24 changes: 15 additions & 9 deletions addons/arsenal/functions/fnc_scanConfig.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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];

{
Expand All @@ -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];

0 comments on commit 3ff3b25

Please sign in to comment.