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.
This commit is contained in:
Lupus the Canine 2021-04-09 02:00:35 +02:00
parent 94d5e93485
commit 3af1fb50ab
2 changed files with 6 additions and 3 deletions

View File

@ -107,6 +107,6 @@ if (_showHint) then {
}; };
// Invoke listenable event // Invoke listenable event
["ace_cargoUnloaded", [_item, _vehicle, "paradrop"]] call CBA_fnc_globalEvent; ["ace_cargoUnloaded", [_itemObject, _vehicle, "paradrop"]] call CBA_fnc_globalEvent;
true true

View File

@ -47,14 +47,17 @@ private _space = [_vehicle] call FUNC(getCargoSpaceLeft);
private _itemSize = [_item] call FUNC(getSizeItem); private _itemSize = [_item] call FUNC(getSizeItem);
_vehicle setVariable [QGVAR(space), (_space + _itemSize), true]; _vehicle setVariable [QGVAR(space), (_space + _itemSize), true];
if (_item isEqualType objNull) then { private _itemObject = if (_item isEqualType objNull) then {
detach _item; detach _item;
// hideObjectGlobal must be executed before setPos to ensure light objects are rendered correctly // 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 // do both on server to ensure they are executed in the correct order
[QGVAR(serverUnload), [_item, _emptyPosAGL]] call CBA_fnc_serverEvent; [QGVAR(serverUnload), [_item, _emptyPosAGL]] call CBA_fnc_serverEvent;
_item;
} else { } else {
private _newItem = createVehicle [_item, _emptyPosAGL, [], 0, "NONE"]; private _newItem = createVehicle [_item, _emptyPosAGL, [], 0, "NONE"];
_newItem setPosASL (AGLtoASL _emptyPosAGL); _newItem setPosASL (AGLtoASL _emptyPosAGL);
_newItem;
}; };
// Invoke listenable event
["ace_cargoUnloaded", [_itemObject, _vehicle, "unload"]] call CBA_fnc_globalEvent;
true true