From 8ee11367582ca7f3f70cb559c05bdfa851d9cbe9 Mon Sep 17 00:00:00 2001 From: BaerMitUmlaut Date: Fri, 11 Sep 2015 23:52:00 +0200 Subject: [PATCH] Rewrite canPassMagazine condition --- .../interaction/functions/fnc_canPassMagazine.sqf | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/addons/interaction/functions/fnc_canPassMagazine.sqf b/addons/interaction/functions/fnc_canPassMagazine.sqf index 66108b5a63..4e6f70be0f 100644 --- a/addons/interaction/functions/fnc_canPassMagazine.sqf +++ b/addons/interaction/functions/fnc_canPassMagazine.sqf @@ -18,16 +18,11 @@ #include "script_component.hpp" params ["_player", "_target", "_weapon"]; -private ["_compatibleMags", "_filteredMags"]; +private ["_compatibleMags"]; _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); -_filteredMags = [magazinesAmmoFull _player, { - params ["_className", "", "_loaded"]; - _className in _compatibleMags && !_loaded -}] call EFUNC(common,filter); - -if (!(_filteredMags isEqualTo []) && {{_target canAdd (_x select 0)} count _filteredMags > 0}) then { - true -} else { +{ + _x params ["_className", "", "_loaded"]; + if ((_className in _compatibleMags) && {!_loaded} && {_target canAdd _className}) exitWith {true}; false -}; \ No newline at end of file +} foreach (magazinesAmmoFull _player); \ No newline at end of file