Fastroping - Fix FRIES not working after vehicle respawn (#10268)

This commit is contained in:
johnb432 2024-08-27 23:30:16 +02:00 committed by GitHub
parent 884ae78704
commit 96700e8dfd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View File

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

View File

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