Safemode - Fix safemode being broken after respawning (#10260)

* Fix safemode being broken when respawning

* Update addons/safemode/XEH_postInit.sqf

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update XEH_postInit.sqf

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
johnb432 2024-08-26 18:33:40 +02:00 committed by GitHub
parent da73cf979d
commit a894fc78c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,3 +27,19 @@ if (!hasInterface) exitWith {};
// Player HUD // Player HUD
!_weaponSafe call FUNC(setSafeModeVisual); !_weaponSafe call FUNC(setSafeModeVisual);
}] call CBA_fnc_addPlayerEventHandler; }] call CBA_fnc_addPlayerEventHandler;
// Variables are transferred from corpse to new body and EH above triggers on respawn, which desyncs safeties
// Therefore, clear variables and remove mouse button input blocking upon respawn
[QUOTE(ADDON), "Respawn", {
params ["_unit"];
_unit setVariable [QGVAR(safedWeapons), nil];
private _ehID = _unit getVariable QGVAR(actionID);
if (isNil "_ehID") exitWith {};
[_unit, "DefaultAction", _ehID] call EFUNC(common,removeActionEventHandler);
_unit setVariable [QGVAR(actionID), nil];
}] call EFUNC(common,addPlayerEH);