From 503493db70c65d1d9870cfadeb403824e63c5a94 Mon Sep 17 00:00:00 2001 From: Tapawingo Date: Thu, 21 Dec 2023 23:17:40 +0100 Subject: [PATCH 1/3] Fixed addToInventory issue --- addons/misc/functions/fnc_FAK_unpack.sqf | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/addons/misc/functions/fnc_FAK_unpack.sqf b/addons/misc/functions/fnc_FAK_unpack.sqf index 3b07d9160..0225aaeec 100644 --- a/addons/misc/functions/fnc_FAK_unpack.sqf +++ b/addons/misc/functions/fnc_FAK_unpack.sqf @@ -23,12 +23,31 @@ params ["_unit", "_item", "_type", "_slot"]; private _fnc_arrayToInvItem = { params ["_unit", "_array", "_container"]; + private _groundContainer = nearestObjects [_unit, ["WeaponHolder_Single_F"], 2] param [0]; + { for "_i" from 1 to (_x select 1) do { - [_unit, _x select 0, _container] call ACEFUNC(common,addToInventory); + 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); + }; } } foreach _array; + + // Cleanup if no items were dropped + if (count itemCargo _groundContainer isEqualTo 0) then { + deleteVehicle _groundContainer; + } }; private _fnc_getContainer = { From e5606e04cf790e637261b0947061e6a8e42ea929 Mon Sep 17 00:00:00 2001 From: Tapawingo Date: Thu, 21 Dec 2023 23:20:21 +0100 Subject: [PATCH 2/3] Remove unused Code --- addons/misc/functions/fnc_FAK_unpack.sqf | 5 ----- 1 file changed, 5 deletions(-) diff --git a/addons/misc/functions/fnc_FAK_unpack.sqf b/addons/misc/functions/fnc_FAK_unpack.sqf index 0225aaeec..10b179ed2 100644 --- a/addons/misc/functions/fnc_FAK_unpack.sqf +++ b/addons/misc/functions/fnc_FAK_unpack.sqf @@ -43,11 +43,6 @@ private _fnc_arrayToInvItem = { }; } } foreach _array; - - // Cleanup if no items were dropped - if (count itemCargo _groundContainer isEqualTo 0) then { - deleteVehicle _groundContainer; - } }; private _fnc_getContainer = { From d5b3975a6b86a561f73c44e2f5ad8c3f1d8f938f Mon Sep 17 00:00:00 2001 From: Tapawingo Date: Thu, 21 Dec 2023 23:45:13 +0100 Subject: [PATCH 3/3] Added all ground containers to nearest search --- addons/misc/functions/fnc_FAK_unpack.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/misc/functions/fnc_FAK_unpack.sqf b/addons/misc/functions/fnc_FAK_unpack.sqf index 10b179ed2..ebe3156fe 100644 --- a/addons/misc/functions/fnc_FAK_unpack.sqf +++ b/addons/misc/functions/fnc_FAK_unpack.sqf @@ -23,7 +23,7 @@ params ["_unit", "_item", "_type", "_slot"]; private _fnc_arrayToInvItem = { params ["_unit", "_array", "_container"]; - private _groundContainer = nearestObjects [_unit, ["WeaponHolder_Single_F"], 2] param [0]; + private _groundContainer = nearestObjects [_unit, ["GroundWeaponHolder", "WeaponHolder", "Library_WeaponHolder", "WeaponHolderSimulated"], 2] param [0]; { for "_i" from 1 to (_x select 1) do