From 3af1fb50abbcc5574fec91cd085849b4c37210c7 Mon Sep 17 00:00:00 2001 From: Lupus the Canine Date: Fri, 9 Apr 2021 02:00:35 +0200 Subject: [PATCH] Small fixes in ace_cargo Makes paradropItem and unloadItem invoke event "ace_cargoUnloaded" with parameters _itemObject, _vehicle and "paradrop" or "unload" respectivelty. paradropItem invoked said event but if item was classname it would send classname to event which is not particularly useful. --- addons/cargo/functions/fnc_paradropItem.sqf | 2 +- addons/cargo/functions/fnc_unloadItem.sqf | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/cargo/functions/fnc_paradropItem.sqf b/addons/cargo/functions/fnc_paradropItem.sqf index 4e314cdf37..96f642a675 100644 --- a/addons/cargo/functions/fnc_paradropItem.sqf +++ b/addons/cargo/functions/fnc_paradropItem.sqf @@ -107,6 +107,6 @@ if (_showHint) then { }; // Invoke listenable event -["ace_cargoUnloaded", [_item, _vehicle, "paradrop"]] call CBA_fnc_globalEvent; +["ace_cargoUnloaded", [_itemObject, _vehicle, "paradrop"]] call CBA_fnc_globalEvent; true diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf index 6f0f97cb43..2b9052edd2 100644 --- a/addons/cargo/functions/fnc_unloadItem.sqf +++ b/addons/cargo/functions/fnc_unloadItem.sqf @@ -47,14 +47,17 @@ private _space = [_vehicle] call FUNC(getCargoSpaceLeft); private _itemSize = [_item] call FUNC(getSizeItem); _vehicle setVariable [QGVAR(space), (_space + _itemSize), true]; -if (_item isEqualType objNull) then { +private _itemObject = 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; + _item; } else { private _newItem = createVehicle [_item, _emptyPosAGL, [], 0, "NONE"]; _newItem setPosASL (AGLtoASL _emptyPosAGL); + _newItem; }; - +// Invoke listenable event +["ace_cargoUnloaded", [_itemObject, _vehicle, "unload"]] call CBA_fnc_globalEvent; true