Cargo - Remove cargo objects from zeus editable objects (#9400)

Remove cargo from zeus editable objects
This commit is contained in:
johnb432 2023-11-11 01:13:53 +01:00 committed by GitHub
parent 548ab810df
commit 4dd2568fe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 4 deletions

View File

@ -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);
};

View File

@ -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);

View File

@ -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), {