From 96700e8dfd78cc8f531aac422ec12ddcb70da4ed Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Tue, 27 Aug 2024 23:30:16 +0200 Subject: [PATCH] Fastroping - Fix FRIES not working after vehicle respawn (#10268) --- addons/fastroping/XEH_postInit.sqf | 8 ++++++++ addons/fastroping/functions/fnc_equipFRIES.sqf | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/addons/fastroping/XEH_postInit.sqf b/addons/fastroping/XEH_postInit.sqf index 0ba9231215..1daecbb715 100644 --- a/addons/fastroping/XEH_postInit.sqf +++ b/addons/fastroping/XEH_postInit.sqf @@ -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", { diff --git a/addons/fastroping/functions/fnc_equipFRIES.sqf b/addons/fastroping/functions/fnc_equipFRIES.sqf index 615840cb75..869473cdd1 100644 --- a/addons/fastroping/functions/fnc_equipFRIES.sqf +++ b/addons/fastroping/functions/fnc_equipFRIES.sqf @@ -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 { @@ -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