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

Fastroping - Fix FRIES not working after vehicle respawn #10268

Merged
merged 1 commit into from
Aug 27, 2024
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
8 changes: 8 additions & 0 deletions addons/fastroping/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ if (isServer) then {
}, true, ["ACE_friesBase"], true] call CBA_fnc_addClassEventHandler;
};

// Handles the Vanilla respawn module
[missionNamespace, "respawn", {
params ["_vehicle"];

if !(_vehicle getVariable [QGVAR(addFRIESOnRespawn), false]) exitWith {};

_vehicle call FUNC(equipFRIES);
}] call BIS_fnc_addScriptedEventHandler;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I hate it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I aim to please :)


#ifdef DRAW_FASTROPE_INFO
addMissionEventHandler ["Draw3D", {
Expand Down
8 changes: 7 additions & 1 deletion addons/fastroping/functions/fnc_equipFRIES.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
params ["_vehicle"];

if (!alive _vehicle) exitWith { WARNING_1("bad vehicle %1",_this); };
if (alive (_vehicle getVariable [QGVAR(FRIES),objNull])) exitWith { WARNING_1("already equiped %1",_this); };
if (alive (_vehicle getVariable [QGVAR(FRIES), objNull])) exitWith { WARNING_1("already equipped %1",_this); };

private _config = configOf _vehicle;
if !(isNumber (_config >> QGVAR(enabled))) then {
Expand All @@ -29,6 +29,12 @@
private _fries = (getText (_config >> QGVAR(friesType))) createVehicle [0, 0, 0];
_fries attachTo [_vehicle, getArray (_config >> QGVAR(friesAttachmentPoint))];
_vehicle setVariable [QGVAR(FRIES), _fries, true];

// The Vanilla respawn module copies all variables from old object to new one
// Use that to move variable from wreck to new vehicle
_vehicle setVariable [QGVAR(addFRIESOnRespawn), true, true];
};
};
}, _this] call CBA_fnc_execNextFrame;

nil