From ee921565e45c83a4b184e2339104feadbfc39f44 Mon Sep 17 00:00:00 2001 From: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com> Date: Sat, 20 Jul 2024 12:06:49 -0700 Subject: [PATCH] Misc - Fix IFAK unpacking causing crash (#556) **When merged this pull request will:** -Fix the issue with people crashing when an FAK is unpacked when there is not enough inventory space ### IMPORTANT - [Development Guidelines](https://ace3.acemod.org/wiki/development/) are read, understood and applied. - Title of this PR uses our standard template `Component - Add|Fix|Improve|Change|Make|Remove {changes}`. --- addons/misc/functions/fnc_FAK_unpack.sqf | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/addons/misc/functions/fnc_FAK_unpack.sqf b/addons/misc/functions/fnc_FAK_unpack.sqf index f328a5839..65b758940 100644 --- a/addons/misc/functions/fnc_FAK_unpack.sqf +++ b/addons/misc/functions/fnc_FAK_unpack.sqf @@ -23,24 +23,10 @@ params ["_unit", "_item", "_type", "_slot"]; private _fnc_arrayToInvItem = { params ["_unit", "_array", "_container"]; - private _groundContainer = nearestObjects [_unit, ["GroundWeaponHolder", "WeaponHolder", "Library_WeaponHolder", "WeaponHolderSimulated"], 2] param [0]; - { for "_i" from 1 to (_x select 1) do { - private _inventory = [_unit, _x select 0, _container] call ACEFUNC(common,addToInventory); - - if !(_inventory select 0) then { - if (isNil "_groundContainer") exitWith { - _groundContainer = _inventory select 1; - }; - - { - _groundContainer addItemCargoGlobal [_x, 1]; - } forEach itemCargo (_inventory select 1); - - deleteVehicle (_inventory select 1); - }; + [_unit, _x select 0, _container] call ACEFUNC(common,addToInventory); } } foreach _array; }; @@ -161,4 +147,4 @@ if (_slot > 0) then { [_unit, (_itemList select _forEachIndex), _container] call _fnc_arrayToInvItem; }; } forEach _slotArray; -}; \ No newline at end of file +};