Skip to content

Commit

Permalink
Fastroping - Fix FRIES not working after vehicle respawn (#10268)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb432 authored Aug 27, 2024
1 parent 884ae78 commit 96700e8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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;

#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

0 comments on commit 96700e8

Please sign in to comment.