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

Arsenal - Add magazineWell support #6355

Merged
merged 2 commits into from
Jun 1, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, _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
20 changes: 11 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,16 @@ 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 _magList = [];
{
_magList append getArray _x;
} foreach configProperties [_x, "isArray _x", true];

[_magazineGroups, 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];