Skip to content

Commit

Permalink
Repair - Fix unit being vanilla engineer with Repair enabled (#10337)
Browse files Browse the repository at this point in the history
Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 3, 2024
1 parent 24f06c7 commit 4114631
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions addons/repair/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,27 @@

["CAManBase", "InitPost", {
params ["_unit"];
if !(local _unit && {_unit getUnitTrait "engineer"}) exitWith {};
_unit setUnitTrait ["engineer", false];
if (_unit getVariable ["ACE_IsEngineer", -1] isEqualTo -1) then {
_unit setVariable ["ACE_IsEngineer", true, true];
private _isEngineer = _unit getUnitTrait "engineer";
if (isNil "_isEngineer" || {_isEngineer isNotEqualTo true}) exitWith {};
TRACE_4("setUnitTrait 1",_unit,typeOf _unit,local _unit,ACE_player);

if (local _unit) exitWith {
_unit setUnitTrait ["engineer", false];

if (_unit getVariable ["ACE_IsEngineer", -1] isEqualTo -1) then {
_unit setVariable ["ACE_IsEngineer", true, true];
};
};
TRACE_3("setUnitTrait",_unit,typeOf _unit,_unit getUnitTrait "engineer");

// Handle player locality delay, can be anywhere from instant to 10+ seconds (#10337)
if (_unit isNotEqualTo ACE_player) exitWith {};
_unit addEventHandler ["Local", {
params ["_unit", "_isLocal"];
if (!_isLocal) exitWith {};
TRACE_3("setUnitTrait 2",_unit,typeOf _unit,_unit getUnitTrait "engineer");
_unit setUnitTrait ["engineer", false];
_unit removeEventHandler ["Local", _thisEventHandler];
}];
}, true, [], true] call CBA_fnc_addClassEventHandler;


Expand Down

0 comments on commit 4114631

Please sign in to comment.