Add names of dependant hitpoints to parent

This commit is contained in:
Ivanowicz 2023-10-25 15:35:49 +02:00
parent c4464697e4
commit aab542aa27
4 changed files with 16 additions and 4 deletions

View File

@ -31,7 +31,7 @@ if (_type in _initializedClasses) exitWith {};
if (_type == "") exitWith {};
// get selections to ignore
private _selectionsToIgnore = _vehicle call FUNC(getSelectionsToIgnore);
([_vehicle] call FUNC(getSelectionsToIgnore)) params["_selectionsToIgnore", "_dependsArray"];
// get all hitpoints and selections
(getAllHitPointsDamage _vehicle) params [["_hitPoints", []], ["_hitSelections", []]]; // Since 1.82 these are all lower case
@ -156,6 +156,15 @@ private _turretPaths = ((fullCrew [_vehicle, "gunner", true]) + (fullCrew [_vehi
_hitPointsAddedStrings = _trackArray select 1;
_hitPointsAddedAmount = _trackArray select 2;
// Add name of dependant hitpoints to the parent hitpoint
{
if (_hitpoint == (_x select 0)) then {
private _dependsHitpoint = (_x select 1);
([_dependsHitpoint, "%1", _dependsHitpoint, [_hitPointsAddedNames, _hitPointsAddedStrings, _hitPointsAddedAmount]] call FUNC(getHitPointString)) params ["_dependsText", ""];
_text = _text + " / " + _dependsText;
};
} forEach _dependsArray;
if (_hitpoint in TRACK_HITPOINTS) then {
_position = compile format ["private _return = _target selectionPosition ['%1', 'HitPoints']; _return set [1, 0]; _return", _selection];
TRACE_4("Adding RepairTrack",_hitpoint,_forEachIndex,_selection,_text);

View File

@ -32,7 +32,7 @@ if (_totalTime - _elapsedTime > ([_engineer, _vehicle] call FUNC(getFullRepairTi
private _allHitPointsDamage = getAllHitPointsDamage _vehicle;
_allHitPointsDamage params ["_hitPoints", "", "_damageValues"];
private _selectionsToIgnore = _vehicle call FUNC(getSelectionsToIgnore);
([_vehicle] call FUNC(getSelectionsToIgnore)) params["_selectionsToIgnore", ""];
private _firstDamagedIndex = {
if (_x > 0 && {!(_forEachIndex in _selectionsToIgnore)}) exitWith {_forEachIndex};

View File

@ -21,7 +21,7 @@ params ["_engineer", "_vehicle"];
private _allHitPointsDamage = getAllHitPointsDamage _vehicle;
_allHitPointsDamage params ["_hitPoints", "", "_damageValues"];
private _selectionsToIgnore = _vehicle call FUNC(getSelectionsToIgnore);
([_vehicle] call FUNC(getSelectionsToIgnore)) params["_selectionsToIgnore", ""];
private _repairsNeeded = 0;
private _doExtraRepair = false;

View File

@ -31,6 +31,7 @@ private _turretPaths = ((fullCrew [_vehicle, "gunner", true]) + (fullCrew [_vehi
([_vehicle] call FUNC(getWheelHitPointsWithSelections)) params ["_wheelHitPoints", "_wheelHitSelections"];
private _indexesToIgnore = [];
private _dependsArray = [];
private _processedSelections = [];
{
@ -128,8 +129,10 @@ private _processedSelections = [];
ERROR_2("[%1] hitpoint [%2] is both a group-parent and a depends and will be unrepairable",_type,_hitpoint);
ERROR_1("group: %1",_hitpointGroups # _groupIndex);
};
private _dependsParentHitpoint = [_vehCfg >> "HitPoints" >> _hitpoint, "depends"] call BIS_fnc_returnConfigEntry;
_indexesToIgnore pushBack _forEachIndex;
_dependsArray pushBack [_dependsParentHitpoint, _hitpoint];
_processedSelections pushBack _selection;
continue
};
@ -150,4 +153,4 @@ private _processedSelections = [];
_initializedClasses set [_type, _indexesToIgnore];
missionNamespace setVariable [QGVAR(hitPointsToIgnoreInitializedClasses), _initializedClasses];
_indexesToIgnore
[_indexesToIgnore, _dependsArray]