Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair - Fix unit being vanilla engineer when ACE Repair is enabled #10337

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 delay of player locality pass
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