Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cargo - Remove cargo objects from zeus editable objects #9400

Merged
merged 1 commit into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions addons/cargo/functions/fnc_loadItem.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
9 changes: 9 additions & 0 deletions addons/cargo/functions/fnc_unloadItem.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 16 additions & 4 deletions addons/zeus/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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), {
Expand Down