From 095fe2b874a090919986009be4bcf4d84c9f50bb Mon Sep 17 00:00:00 2001 From: GhostIsSpooky <69561145+Salluci@users.noreply.github.com> Date: Wed, 13 Oct 2021 00:20:36 -0300 Subject: [PATCH] Repair - Add support for RHS optic hitpoints (#8347) * Potential fix for #8304 Update fnc_addRepairActions to include hitpoints that influence turret view * Support for the RHS Stryker hitpoints This whole function is a nightmare but there's no better way to do this. Side effects may include unnecessary hitpoints being shown. * Style pass * whoops --- addons/repair/functions/fnc_addRepairActions.sqf | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index af9c78361ef..b3d2bb91dfc 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -37,7 +37,7 @@ private _hitPointsAddedAmount = []; private _processedSelections = []; private _icon = ["a3\ui_f\data\igui\cfg\actions\repair_ca.paa", "#FFFFFF"]; -private _vehCfg = configFile >> "CfgVehicles" >> _type; +private _vehCfg = configOf _vehicle; // Custom position can be defined via config for associated hitpoint private _hitpointPositions = getArray (_vehCfg >> QGVAR(hitpointPositions)); // Associated hitpoints can be grouped via config to produce a single repair action @@ -94,12 +94,18 @@ private _turretPaths = ((fullCrew [_vehicle, "gunner", true]) + (fullCrew [_vehi private _hitpointsCfg = "configName _x == _hitpoint" configClasses _turretHitpointCfg; if (_hitpointsCfg isNotEqualTo []) exitWith { TRACE_2("turret hitpoint configFound",_hitpoint,_x); - // only do turret hitpoints for now or we get some weird stuff - if ((_hitpoint in ["hitturret", "hitgun"]) || {(getNumber (_hitpointsCfg # 0 >> "isGun")) == 1} || {(getNumber (_hitpointsCfg # 0 >> "isTurret")) == 1}) then { + // only do turret hitpoints or stuff linked to visuals for now or we apparently get some weird stuff + if ((_hitpoint in ["hitturret", "hitgun"]) || {(getNumber (_hitpointsCfg # 0 >> "isGun")) == 1} || {(getNumber (_hitpointsCfg # 0 >> "isTurret")) == 1} || {(getText (_hitpointsCfg # 0 >> "visual")) != ""}) then { _armorComponent = getText (_hitpointsCfg # 0 >> "armorComponent"); }; }; } forEach _turretPaths; + if (_armorComponent == "") then { + private _hitpointsCfg = "configName _x == _hitpoint" configClasses (_vehCfg >> "HitPoints"); + if ((getText (_hitpointsCfg # 0 >> "visual")) != "") then { + _armorComponent = getText (_hitpointsCfg # 0 >> "armorComponent"); + }; + }; if (_armorComponent != "") then { INFO_3("%1: %2 no selection: using armorComponent %3",_type,_hitpoint,_armorComponent); }; }; if ((_selection == "") && {_armorComponent == ""}) exitWith { TRACE_3("Skipping no selection OR armor component",_hitpoint,_forEachIndex,_selection); };