From 10ca3d6678d8645ab6d0b56c0104c923a0237fd8 Mon Sep 17 00:00:00 2001 From: Vdauphin Date: Wed, 4 Nov 2020 13:56:13 +0100 Subject: [PATCH] Unload _item when is vehicle in vehicle --- addons/cargo/functions/fnc_unloadItem.sqf | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf index 6f0f97cb43..f95fec144c 100644 --- a/addons/cargo/functions/fnc_unloadItem.sqf +++ b/addons/cargo/functions/fnc_unloadItem.sqf @@ -48,10 +48,15 @@ private _itemSize = [_item] call FUNC(getSizeItem); _vehicle setVariable [QGVAR(space), (_space + _itemSize), true]; if (_item isEqualType objNull) then { - detach _item; - // hideObjectGlobal must be executed before setPos to ensure light objects are rendered correctly - // do both on server to ensure they are executed in the correct order - [QGVAR(serverUnload), [_item, _emptyPosAGL]] call CBA_fnc_serverEvent; + if (isVehicleCargo _item) then { + objNull setVehicleCargo _item; + _item setPosASL (AGLtoASL _emptyPosAGL); + } else { + detach _item; + // hideObjectGlobal must be executed before setPos to ensure light objects are rendered correctly + // do both on server to ensure they are executed in the correct order + [QGVAR(serverUnload), [_item, _emptyPosAGL]] call CBA_fnc_serverEvent; + }; } else { private _newItem = createVehicle [_item, _emptyPosAGL, [], 0, "NONE"]; _newItem setPosASL (AGLtoASL _emptyPosAGL);