From 1ee2e6adb271de4bf69921fc0043cbb84d33da47 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 22 Feb 2020 15:15:09 -0600 Subject: [PATCH] Arsenal - Filter non-scope 2 mags from being auto-added (#7445) --- .../arsenal/functions/fnc_onSelChangedLeft.sqf | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/addons/arsenal/functions/fnc_onSelChangedLeft.sqf b/addons/arsenal/functions/fnc_onSelChangedLeft.sqf index f2bdc482947..7d77b8c2b7d 100644 --- a/addons/arsenal/functions/fnc_onSelChangedLeft.sqf +++ b/addons/arsenal/functions/fnc_onSelChangedLeft.sqf @@ -57,8 +57,12 @@ switch (GVAR(currentLeftPanel)) do { call _fnc_clearPreviousWepMags; private _compatibleItems = (_item call bis_fnc_compatibleItems) apply {tolower _x}; + private _cfgMags = configFile >> "CfgMagazines"; + private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 }; GVAR(center) addWeapon _item; - GVAR(center) addWeaponItem [_item, [(getArray (configfile >> "cfgweapons" >> _item >> "magazines")) select 0]]; + if ((count _compatibleMags) > 0) then { + GVAR(center) addWeaponItem [_item, [_compatibleMags select 0]]; + }; { if (tolower _x in _compatibleItems || {_x in _compatibleMags}) then { @@ -95,8 +99,12 @@ switch (GVAR(currentLeftPanel)) do { call _fnc_clearPreviousWepMags; private _compatibleItems = (_item call bis_fnc_compatibleItems) apply {tolower _x}; + private _cfgMags = configFile >> "CfgMagazines"; + private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 }; GVAR(center) addWeapon _item; - GVAR(center) addWeaponItem [_item, [(getArray (configfile >> "cfgweapons" >> _item >> "magazines")) select 0]]; + if ((count _compatibleMags) > 0) then { + GVAR(center) addWeaponItem [_item, [_compatibleMags select 0]]; + }; { if (tolower _x in _compatibleItems || {_x in _compatibleMags}) then { @@ -132,8 +140,12 @@ switch (GVAR(currentLeftPanel)) do { call _fnc_clearPreviousWepMags; private _compatibleItems = (_item call bis_fnc_compatibleItems) apply {tolower _x}; + private _cfgMags = configFile >> "CfgMagazines"; + private _compatibleMags = ([_item, true] call CBA_fnc_compatibleMagazines) select { getNumber (_cfgMags >> _x >> "scope") == 2 }; GVAR(center) addWeapon _item; - GVAR(center) addWeaponItem [_item, [(getArray (configfile >> "cfgweapons" >> _item >> "magazines")) select 0]]; + if ((count _compatibleMags) > 0) then { + GVAR(center) addWeaponItem [_item, [_compatibleMags select 0]]; + }; { if (tolower _x in _compatibleItems || {_x in _compatibleMags}) then {