diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf index ae2d845d38f..587543f7768 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -38,6 +38,17 @@ if (_item isEqualType objNull) then { _item attachTo [_vehicle,[0,0,-100]]; [QEGVAR(common,hideObjectGlobal), [_item, true]] call CBA_fnc_serverEvent; + if (["ace_zeus"] call EFUNC(common,isModLoaded)) then { + private _objectCurators = objectCurators _item; + + // Save which curators had this object as editable + _item setVariable [QGVAR(objectCurators), _objectCurators, true]; + + if (_objectCurators isEqualTo []) exitWith {}; + + [QEGVAR(zeus,removeObjects), [[_item], _objectCurators]] call CBA_fnc_serverEvent; + }; + // Some objects below water will take damage over time and eventualy become "water logged" and unfixable (because of negative z attach) [_item, "blockDamage", "ACE_cargo", true] call EFUNC(common,statusEffect_set); }; diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf index 83b0b2ff0ea..93fdfaa0994 100644 --- a/addons/cargo/functions/fnc_unloadItem.sqf +++ b/addons/cargo/functions/fnc_unloadItem.sqf @@ -53,6 +53,15 @@ if (_object isEqualType objNull) then { // 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), [_object, _emptyPosAGL]] call CBA_fnc_serverEvent; + + if (["ace_zeus"] call EFUNC(common,isModLoaded)) then { + // Get which curators had this object as editable + private _objectCurators = _object getVariable [QGVAR(objectCurators), []]; + + if (_objectCurators isEqualTo []) exitWith {}; + + [QEGVAR(zeus,addObjects), [[_object], _objectCurators]] call CBA_fnc_serverEvent; + }; } else { _object = createVehicle [_item, _emptyPosAGL, [], 0, "NONE"]; _object setPosASL (AGLtoASL _emptyPosAGL); diff --git a/addons/zeus/XEH_postInit.sqf b/addons/zeus/XEH_postInit.sqf index c1dba7e0e48..b4d1302ab5b 100644 --- a/addons/zeus/XEH_postInit.sqf +++ b/addons/zeus/XEH_postInit.sqf @@ -19,20 +19,32 @@ if (isServer) then { [QGVAR(addObjects), { params ["_objects", ["_curator", objNull]]; - if (!isNull _curator) exitWith {_curator addCuratorEditableObjects [_objects, true]}; + // If valid object + if (_curator isEqualType objNull && {!isNull _curator}) exitWith {_curator addCuratorEditableObjects [_objects, true]}; + + // If invalid object (= objNull) or other + if !(_curator isEqualType []) then { + _curator = allCurators; + }; { _x addCuratorEditableObjects [_objects, true]; - } forEach allCurators; + } forEach _curator; }] call CBA_fnc_addEventHandler; [QGVAR(removeObjects), { params ["_objects", ["_curator", objNull]]; - if (!isNull _curator) exitWith {_curator removeCuratorEditableObjects [_objects, true]}; + // If valid object + if (_curator isEqualType objNull && {!isNull _curator}) exitWith {_curator removeCuratorEditableObjects [_objects, true]}; + + // If invalid object (= objNull) or other + if !(_curator isEqualType []) then { + _curator = allCurators; + }; { _x removeCuratorEditableObjects [_objects, true]; - } forEach allCurators; + } forEach _curator; }] call CBA_fnc_addEventHandler; [QGVAR(createZeus), {