Skip to content

Commit

Permalink
Attributes - Add support for ACE Repair 'Enable' setting (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkIsGrim authored Jan 25, 2024
1 parent 9ea2b6b commit 13fb246
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions addons/attributes/initAttributes.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,23 @@ if (isClass (configFile >> "CfgPatches" >> "ace_medical")) then {
] call FUNC(addAttribute);
};

if (isClass (configFile >> "CfgPatches" >> "ace_repair")) then {
private _hasAceRepair = isClass (configFile >> "CfgPatches" >> "ace_repair");

[
"Traits",
"str_b_engineer_f0",
QGVAR(toolbox),
[1, 2, [ELSTRING(common,No), ELSTRING(common,Yes)]],
{
{
[QEGVAR(common,setUnitTrait), [_x, "engineer", _value], _x] call CBA_fnc_targetEvent;
} forEach call EFUNC(common,getSelectedUnits);
},
{_entity getUnitTrait "engineer"},
[{true}, {!(missionNamespace getVariable ["ace_repair_enabled", false])}] select _hasAceRepair
] call FUNC(addAttribute);

if (_hasAceRepair) then {
[
"Traits",
LSTRING(EngineeringSkill),
Expand All @@ -1006,20 +1022,8 @@ if (isClass (configFile >> "CfgPatches" >> "ace_repair")) then {
_x setVariable ["ACE_isEngineer", _value, true];
} forEach call EFUNC(common,getSelectedUnits);
},
{[0, 1, 2] select (_entity getVariable ["ACE_isEngineer", _entity getUnitTrait "engineer"])}
] call FUNC(addAttribute);
} else {
[
"Traits",
"str_b_engineer_f0",
QGVAR(toolbox),
[1, 2, [ELSTRING(common,No), ELSTRING(common,Yes)]],
{
{
[QEGVAR(common,setUnitTrait), [_x, "engineer", _value], _x] call CBA_fnc_targetEvent;
} forEach call EFUNC(common,getSelectedUnits);
},
{_entity getUnitTrait "engineer"}
{[0, 1, 2] select (_entity getVariable ["ACE_isEngineer", _entity getUnitTrait "engineer"])},
{missionNamespace getVariable ["ace_repair_enabled", false]}
] call FUNC(addAttribute);
};

Expand Down

0 comments on commit 13fb246

Please sign in to comment.