mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Revert rogue changes 2
This commit is contained in:
parent
94518c6418
commit
b2fb679659
@ -31,7 +31,7 @@ if (_type in _initializedClasses) exitWith {};
|
|||||||
if (_type == "") exitWith {};
|
if (_type == "") exitWith {};
|
||||||
|
|
||||||
// get selections to ignore
|
// get selections to ignore
|
||||||
([_vehicle] call FUNC(getSelectionsToIgnore)) params ["_indexesToIgnore"];
|
([_vehicle] call FUNC(getSelectionsToIgnore)) params ["_selectionsToIgnore"];
|
||||||
|
|
||||||
// get all hitpoints and selections
|
// get all hitpoints and selections
|
||||||
(getAllHitPointsDamage _vehicle) params [["_hitPoints", []], ["_hitSelections", []]]; // Since 1.82 these are all lower case
|
(getAllHitPointsDamage _vehicle) params [["_hitPoints", []], ["_hitSelections", []]]; // Since 1.82 these are all lower case
|
||||||
@ -55,7 +55,7 @@ private _turretPaths = ((fullCrew [_vehicle, "gunner", true]) + (fullCrew [_vehi
|
|||||||
private _hitpoint = toLowerANSI (_hitPoints select _forEachIndex);
|
private _hitpoint = toLowerANSI (_hitPoints select _forEachIndex);
|
||||||
|
|
||||||
// Skip ignored selections
|
// Skip ignored selections
|
||||||
if (_forEachIndex in _indexesToIgnore) then {
|
if (_forEachIndex in _selectionsToIgnore) then {
|
||||||
TRACE_3("Skipping ignored hitpoint",_hitpoint,_forEachIndex,_selection);
|
TRACE_3("Skipping ignored hitpoint",_hitpoint,_forEachIndex,_selection);
|
||||||
continue
|
continue
|
||||||
};
|
};
|
||||||
@ -109,7 +109,7 @@ private _turretPaths = ((fullCrew [_vehicle, "gunner", true]) + (fullCrew [_vehi
|
|||||||
private _turretHitpointCfg = ([_vehCfg, _x] call CBA_fnc_getTurret) >> "HitPoints";
|
private _turretHitpointCfg = ([_vehCfg, _x] call CBA_fnc_getTurret) >> "HitPoints";
|
||||||
private _hitpointsCfg = "configName _x == _hitpoint" configClasses _turretHitpointCfg;
|
private _hitpointsCfg = "configName _x == _hitpoint" configClasses _turretHitpointCfg;
|
||||||
if (_hitpointsCfg isNotEqualTo []) exitWith {
|
if (_hitpointsCfg isNotEqualTo []) exitWith {
|
||||||
TRACE_2("turret hitPoint configFound",_hitpoint,_x);
|
TRACE_2("turret hitpoint configFound",_hitpoint,_x);
|
||||||
_armorComponent = getText (_hitpointsCfg # 0 >> "armorComponent");
|
_armorComponent = getText (_hitpointsCfg # 0 >> "armorComponent");
|
||||||
};
|
};
|
||||||
} forEach _turretPaths;
|
} forEach _turretPaths;
|
||||||
|
@ -19,13 +19,10 @@
|
|||||||
params ["_unit", "_target"];
|
params ["_unit", "_target"];
|
||||||
TRACE_2("params",_unit,_target);
|
TRACE_2("params",_unit,_target);
|
||||||
|
|
||||||
private _return = false;
|
|
||||||
private _allHitPointsDamage = getAllHitPointsDamage _target;
|
private _allHitPointsDamage = getAllHitPointsDamage _target;
|
||||||
|
|
||||||
if (_allHitPointsDamage isNotEqualTo []) then {
|
if (_allHitPointsDamage isNotEqualTo []) then {
|
||||||
_return = ((_allHitPointsDamage select 2) findIf {_x > 0} != -1);
|
((_allHitPointsDamage select 2) findIf {_x > 0} != -1)
|
||||||
} else {
|
} else {
|
||||||
_return = (damage _target) > 0;
|
(damage _target) > 0
|
||||||
};
|
};
|
||||||
|
|
||||||
_return
|
|
||||||
|
@ -38,7 +38,7 @@ if (isArray _hitpointGroupConfig) then {
|
|||||||
private _subHitpoint = _x;
|
private _subHitpoint = _x;
|
||||||
private _subHitIndex = _allHitPoints findIf {_x == _subHitpoint};
|
private _subHitIndex = _allHitPoints findIf {_x == _subHitpoint};
|
||||||
if (_subHitIndex == -1) then {
|
if (_subHitIndex == -1) then {
|
||||||
ERROR_2("Invalid hitpoint %1 in hitpointGroups of %2",_subHitpoint,_target)
|
ERROR_2("Invalid hitpoint %1 in hitpointGroups of %2",_subHitpoint,_target);
|
||||||
} else {
|
} else {
|
||||||
_hitpointGroup pushBack _subHitIndex;
|
_hitpointGroup pushBack _subHitIndex;
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: Unit that does the repairing <OBJECT>
|
* 0: Unit that does the repairing <OBJECT>
|
||||||
* 1: Vehicle to repair <OBJECT>
|
* 1: Vehicle to repair <OBJECT>
|
||||||
* 2: Selected hitPointIndex <NUMBER>
|
* 2: Selected hitpointIndex <NUMBER>
|
||||||
* 3: Repair action classname <STRING>
|
* 3: Repair action classname <STRING>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
@ -57,18 +57,18 @@ if (_hitPointNewDamage < _hitPointCurDamage) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Get hitpoint groups if available
|
// Get hitpoint groups if available
|
||||||
private _hitPointGroupConfig = configOf _vehicle >> QGVAR(hitpointGroups);
|
private _hitpointGroupConfig = configOf _vehicle >> QGVAR(hitpointGroups);
|
||||||
if (isArray _hitPointGroupConfig) then {
|
if (isArray _hitpointGroupConfig) then {
|
||||||
// Retrieve hitpoint subgroup if current hitpoint is main hitpoint of a group
|
// Retrieve hitpoint subgroup if current hitpoint is main hitpoint of a group
|
||||||
{
|
{
|
||||||
_x params ["_masterHitPoint", "_subHitArray"];
|
_x params ["_masterHitpoint", "_subHitArray"];
|
||||||
// Exit using found hitpoint group if this hitpoint is leader of any
|
// Exit using found hitpoint group if this hitpoint is leader of any
|
||||||
if (_masterHitPoint == _hitPointClassname) exitWith {
|
if (_masterHitpoint == _hitPointClassname) exitWith {
|
||||||
{
|
{
|
||||||
private _subHitPoint = _x;
|
private _subHitpoint = _x;
|
||||||
private _subHitIndex = _allHitPoints findIf {_x == _subHitPoint}; //convert hitpoint classname to index
|
private _subHitIndex = _allHitPoints findIf {_x == _subHitpoint}; //convert hitpoint classname to index
|
||||||
if (_subHitIndex == -1) then {
|
if (_subHitIndex == -1) then {
|
||||||
ERROR_2("Invalid hitpoint %1 in hitPointGroups of %2",_subHitPoint,_vehicle);
|
ERROR_2("Invalid hitpoint %1 in hitpointGroups of %2",_subHitpoint,_vehicle);
|
||||||
} else {
|
} else {
|
||||||
if (_subHitIndex in _repairedHitPoints) then {
|
if (_subHitIndex in _repairedHitPoints) then {
|
||||||
TRACE_2("Skipping repair, sub hitpoint already fixed in depends",_subHitIndex,_vehicle);
|
TRACE_2("Skipping repair, sub hitpoint already fixed in depends",_subHitIndex,_vehicle);
|
||||||
@ -84,7 +84,7 @@ if (isArray _hitPointGroupConfig) then {
|
|||||||
};
|
};
|
||||||
} forEach _subHitArray;
|
} forEach _subHitArray;
|
||||||
};
|
};
|
||||||
} forEach (getArray _hitPointGroupConfig);
|
} forEach (getArray _hitpointGroupConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
// display text message if enabled
|
// display text message if enabled
|
||||||
|
@ -22,19 +22,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_args", "_elapsedTime", "_totalTime"];
|
params ["_args", "_elapsedTime", "_totalTime"];
|
||||||
_args params ["_unit", "_vehicle", "", "_action"];
|
_args params ["_engineer", "_vehicle", "", "_action"];
|
||||||
|
|
||||||
if !((alive _vehicle) && {(abs speed _vehicle) < 1}) exitWith {false}; // make sure vehicle doesn't drive off
|
if !((alive _vehicle) && {(abs speed _vehicle) < 1}) exitWith {false}; // make sure vehicle doesn't drive off
|
||||||
|
|
||||||
// Not enough time has elapsed to repair a hitpoint
|
// Not enough time has elapsed to repair a hitpoint
|
||||||
if (_totalTime - _elapsedTime > ([_unit, _vehicle] call FUNC(getFullRepairTime)) - (GVAR(miscRepairTime) * GVAR(timeCoefficientFullRepair))) exitWith {true};
|
if (_totalTime - _elapsedTime > ([_engineer, _vehicle] call FUNC(getFullRepairTime)) - (GVAR(miscRepairTime) * GVAR(timeCoefficientFullRepair))) exitWith {true};
|
||||||
|
|
||||||
(getAllHitPointsDamage _vehicle) params ["", "", "_damageValues"];
|
private _allHitPointsDamage = getAllHitPointsDamage _vehicle;
|
||||||
|
_allHitPointsDamage params ["_hitPoints", "", "_damageValues"];
|
||||||
|
|
||||||
([_vehicle] call FUNC(getSelectionsToIgnore)) params ["_indexesToIgnore"];
|
([_vehicle] call FUNC(getSelectionsToIgnore)) params ["_selectionsToIgnore"];
|
||||||
|
|
||||||
private _firstDamagedIndex = {
|
private _firstDamagedIndex = {
|
||||||
if (_x > 0 && {!(_forEachIndex in _indexesToIgnore)}) exitWith {_forEachIndex};
|
if (_x > 0 && {!(_forEachIndex in _selectionsToIgnore)}) exitWith {_forEachIndex};
|
||||||
-1
|
-1
|
||||||
} forEach _damageValues;
|
} forEach _damageValues;
|
||||||
|
|
||||||
@ -43,6 +44,6 @@ private _firstDamagedIndex = {
|
|||||||
if (_firstDamagedIndex == -1) exitWith {true};
|
if (_firstDamagedIndex == -1) exitWith {true};
|
||||||
|
|
||||||
// Repair the first damaged hitpoint
|
// Repair the first damaged hitpoint
|
||||||
[_unit, _vehicle, _firstDamagedIndex, _action] call FUNC(doRepair);
|
[_engineer, _vehicle, _firstDamagedIndex, _action] call FUNC(doRepair);
|
||||||
|
|
||||||
true
|
true
|
||||||
|
@ -16,18 +16,18 @@
|
|||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
|
||||||
params ["_unit", "_vehicle"];
|
params ["_engineer", "_vehicle"];
|
||||||
TRACE_2("params",_unit,_vehicle);
|
|
||||||
|
|
||||||
(getAllHitPointsDamage _vehicle) params ["", "", "_damageValues"];
|
private _allHitPointsDamage = getAllHitPointsDamage _vehicle;
|
||||||
|
_allHitPointsDamage params ["_hitPoints", "", "_damageValues"];
|
||||||
|
|
||||||
([_vehicle] call FUNC(getSelectionsToIgnore)) params ["_indexesToIgnore"];
|
([_vehicle] call FUNC(getSelectionsToIgnore)) params ["_selectionsToIgnore"];
|
||||||
|
|
||||||
private _repairsNeeded = 0;
|
private _repairsNeeded = 0;
|
||||||
private _doExtraRepair = false;
|
private _doExtraRepair = false;
|
||||||
{
|
{
|
||||||
if (_x <= 0) then {continue}; // skip hitpoints that don't need repairs
|
if (_x <= 0) then {continue}; // skip hitpoints that don't need repairs
|
||||||
if (_forEachIndex in _indexesToIgnore) then { // only add extra repair for ignore hitpoints if they're damaged
|
if (_forEachIndex in _selectionsToIgnore) then { // only add extra repair for ignore hitpoints if they're damaged
|
||||||
_doExtraRepair = true;
|
_doExtraRepair = true;
|
||||||
continue
|
continue
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,7 @@ private _track = _trackArray isNotEqualTo [];
|
|||||||
private _text = LSTRING(Hit);
|
private _text = LSTRING(Hit);
|
||||||
|
|
||||||
// Remove # prefix
|
// Remove # prefix
|
||||||
if ((_hitPoint select [0, 1]) == "#") then { _hitPoint = _hitPoint select [1] };
|
if ((_hitpoint select [0, 1]) == "#") then { _hitPoint = _hitPoint select [1] };
|
||||||
|
|
||||||
// Remove "Hit" from hitpoint name if one exists
|
// Remove "Hit" from hitpoint name if one exists
|
||||||
private _toFind = if ((toLowerANSI _hitPoint) find "hit" == 0) then {
|
private _toFind = if ((toLowerANSI _hitPoint) find "hit" == 0) then {
|
||||||
|
@ -27,14 +27,11 @@ params ["_vehicle"];
|
|||||||
|
|
||||||
private _type = typeOf _vehicle;
|
private _type = typeOf _vehicle;
|
||||||
TRACE_2("getSelectionsToIgnore",_vehicle,_type);
|
TRACE_2("getSelectionsToIgnore",_vehicle,_type);
|
||||||
private _initializedClasses = GETMVAR(GVAR(ignoredAndDependsInitializedClasses),createHashMap);
|
private _initializedClasses = missionNamespace getVariable [QGVAR(hitPointsToIgnoreInitializedClasses), createHashMap];
|
||||||
if (_type in _initializedClasses) exitWith {
|
if (_type in _initializedClasses) exitWith {_initializedClasses get _type};
|
||||||
TRACE_2("retrieved cached selections",_vehicle,_type);
|
|
||||||
_initializedClasses get _type;
|
|
||||||
}; //you return different amount of values each time
|
|
||||||
|
|
||||||
private _vehCfg = configOf _vehicle;
|
private _vehCfg = configOf _vehicle;
|
||||||
private _hitPointGroups = getArray (_vehCfg >> QGVAR(hitpointGroups));
|
private _hitpointGroups = getArray (_vehCfg >> QGVAR(hitpointGroups));
|
||||||
private _turretPaths = ((fullCrew [_vehicle, "gunner", true]) + (fullCrew [_vehicle, "commander", true])) apply {_x # 3};
|
private _turretPaths = ((fullCrew [_vehicle, "gunner", true]) + (fullCrew [_vehicle, "commander", true])) apply {_x # 3};
|
||||||
|
|
||||||
(getAllHitPointsDamage _vehicle) params [["_hitPoints", []], ["_hitSelections", []]];
|
(getAllHitPointsDamage _vehicle) params [["_hitPoints", []], ["_hitSelections", []]];
|
||||||
@ -48,33 +45,42 @@ private _complexDependsMap = createHashMap;
|
|||||||
|
|
||||||
{
|
{
|
||||||
private _selection = _x;
|
private _selection = _x;
|
||||||
private _hitPoint = toLowerANSI (_hitPoints select _forEachIndex);
|
private _hitpoint = toLowerANSI (_hitPoints select _forEachIndex);
|
||||||
private _isWheelOrTrack = _selection in _wheelHitSelections || {_hitPoint in _wheelHitPoints} || {_hitPoint in TRACK_HITPOINTS};
|
private _isWheelOrTrack = _selection in _wheelHitSelections || {_hitpoint in _wheelHitPoints} || {_hitpoint in TRACK_HITPOINTS};
|
||||||
|
|
||||||
if (_hitPoint isEqualTo "") then { // skip empty hitpoint
|
if (_hitpoint isEqualTo "") then { // skip empty hitpoint
|
||||||
_indexesToIgnore pushBack _forEachIndex;
|
_indexesToIgnore pushBack _forEachIndex;
|
||||||
continue
|
continue
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_isWheelOrTrack && {_selection in _processedSelections || {_selection isEqualTo ""}}) then {
|
if (_isWheelOrTrack && {_selection in _processedSelections || {_selection isEqualTo ""}}) then { // skip duplicate or empty selection wheel/track
|
||||||
TRACE_3("Skipping duplicate Wheel/Track or empty selection",_hitPoint,_forEachIndex,_selection);
|
TRACE_3("Skipping duplicate Wheel/Track or empty selection",_hitpoint,_forEachIndex,_selection);
|
||||||
|
/*#ifdef DEBUG_MODE_FULL
|
||||||
|
systemChat format ["Skipping duplicate wheel, hitpoint %1, index %2, selection %3", _hitpoint, _forEachIndex, _selection];
|
||||||
|
#endif*/
|
||||||
_indexesToIgnore pushBack _forEachIndex;
|
_indexesToIgnore pushBack _forEachIndex;
|
||||||
_processedSelections pushBack _selection;
|
_processedSelections pushBack _selection;
|
||||||
continue
|
continue
|
||||||
};
|
};
|
||||||
|
|
||||||
if ("glass" in _hitPoint) then {
|
if ("glass" in _hitpoint) then { // skip glass
|
||||||
TRACE_3("Skipping glass",_hitPoint,_forEachIndex,_selection);
|
TRACE_3("Skipping glass",_hitpoint,_forEachIndex,_selection);
|
||||||
|
/*#ifdef DEBUG_MODE_FULL
|
||||||
|
systemChat format ["Skipping glass, hitpoint %1, index %2, selection %3", _hitpoint, _forEachIndex, _selection];
|
||||||
|
#endif*/
|
||||||
_indexesToIgnore pushBack _forEachIndex;
|
_indexesToIgnore pushBack _forEachIndex;
|
||||||
_processedSelections pushBack _selection;
|
_processedSelections pushBack _selection;
|
||||||
continue
|
continue
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_hitPoint select [0,7] isEqualTo "hitera_" || {_hitPoint select [0,4] isEqualTo "era_"}
|
if (_hitpoint select [0,7] isEqualTo "hitera_" || {_hitpoint select [0,4] isEqualTo "era_"} // skip era/slat
|
||||||
|| {_hitPoint select [0,8] isEqualTo "hitslat_"} || {_hitPoint select [0,5] isEqualTo "slat_"}
|
|| {_hitpoint select [0,8] isEqualTo "hitslat_"} || {_hitpoint select [0,5] isEqualTo "slat_"}
|
||||||
|| {_hitPoint select [0,9] isEqualTo "sideskirt"} || {_hitPoint select [0,6] isEqualTo "armor_"}
|
|| {_hitpoint select [0,9] isEqualTo "sideskirt"} || {_hitpoint select [0,6] isEqualTo "armor_"}
|
||||||
|| {_hitPoint select [0,3] isEqualTo "mud"} || {_hitPoint select [0,9] isEqualTo "smoketube"}) then {
|
|| {_hitpoint select [0,3] isEqualTo "mud"} || {_hitpoint select [0,9] isEqualTo "smoketube"}) then {
|
||||||
TRACE_3("Skipping ERA/Slat/Sideskirt/Armor/Mudguard/Smoketube HitPoint",_hitPoint,_forEachIndex,_selection);
|
TRACE_3("Skipping ERA/Slat/Sideskirt/Armor/Mudguard/Smoketube HitPoint",_hitpoint,_forEachIndex,_selection);
|
||||||
|
/*#ifdef DEBUG_MODE_FULL
|
||||||
|
systemChat format ["Skipping ERA/Slat/Sideskirt/Armor/Mudguard/Smoketube HitPoint, hitpoint %1, index %2, selection %3", _hitpoint, _forEachIndex, _selection];
|
||||||
|
#endif*/
|
||||||
_indexesToIgnore pushBack _forEachIndex;
|
_indexesToIgnore pushBack _forEachIndex;
|
||||||
_processedSelections pushBack _selection;
|
_processedSelections pushBack _selection;
|
||||||
continue
|
continue
|
||||||
@ -83,52 +89,55 @@ private _complexDependsMap = createHashMap;
|
|||||||
private _armorComponent = "";
|
private _armorComponent = "";
|
||||||
if (_selection == "") then { // some hitpoints have empty selection but defined armor component (mostly RHS)
|
if (_selection == "") then { // some hitpoints have empty selection but defined armor component (mostly RHS)
|
||||||
{
|
{
|
||||||
private _turretHitPointCfg = ([_vehCfg, _x] call CBA_fnc_getTurret) >> "HitPoints";
|
private _turretHitpointCfg = ([_vehCfg, _x] call CBA_fnc_getTurret) >> "HitPoints";
|
||||||
private _hitPointsCfg = "configName _x == _hitPoint" configClasses _turretHitPointCfg;
|
private _hitpointsCfg = "configName _x == _hitpoint" configClasses _turretHitpointCfg;
|
||||||
if (_hitPointsCfg isNotEqualTo []) exitWith {
|
if (_hitpointsCfg isNotEqualTo []) exitWith {
|
||||||
TRACE_2("turret hitpoint config found",_hitPoint,_x);
|
TRACE_2("turret hitpoint configFound",_hitpoint,_x);
|
||||||
_hitPointsCfg = _hitPointsCfg # 0;
|
_hitpointsCfg = _hitpointsCfg # 0;
|
||||||
// only do turret hitpoints and stuff linked to visuals
|
// only do turret hitpoints and stuff linked to visuals
|
||||||
if (
|
if (
|
||||||
(_hitPoint in ["hitturret", "hitgun"]) ||
|
(_hitpoint in ["hitturret", "hitgun"]) ||
|
||||||
{(getNumber (_hitPointsCfg >> "isGun")) == 1} ||
|
{(getNumber (_hitpointsCfg >> "isGun")) == 1} ||
|
||||||
{(getNumber (_hitPointsCfg >> "isTurret")) == 1} ||
|
{(getNumber (_hitpointsCfg >> "isTurret")) == 1} ||
|
||||||
{(getText (_hitPointsCfg >> "visual")) != ""}
|
{(getText (_hitpointsCfg >> "visual")) != ""}
|
||||||
) then {
|
) then {
|
||||||
_armorComponent = getText (_hitPointsCfg >> "armorComponent");
|
_armorComponent = getText (_hitpointsCfg >> "armorComponent");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} forEach _turretPaths;
|
} forEach _turretPaths;
|
||||||
if (_armorComponent == "") then {
|
if (_armorComponent == "") then {
|
||||||
private _hitPointsCfg = "configName _x == _hitPoint" configClasses (_vehCfg >> "HitPoints");
|
private _hitpointsCfg = "configName _x == _hitpoint" configClasses (_vehCfg >> "HitPoints");
|
||||||
if (_hitPointsCfg isNotEqualTo []) then {
|
if (_hitpointsCfg isNotEqualTo []) then {
|
||||||
_hitPointsCfg = _hitPointsCfg # 0;
|
_hitpointsCfg = _hitpointsCfg # 0;
|
||||||
if (
|
if (
|
||||||
(getNumber (_hitPointsCfg >> "isGun")) == 1 ||
|
(getNumber (_hitpointsCfg >> "isGun")) == 1 ||
|
||||||
{(getNumber (_hitPointsCfg >> "isTurret")) == 1} ||
|
{(getNumber (_hitpointsCfg >> "isTurret")) == 1} ||
|
||||||
{(getText (_hitPointsCfg >> "visual")) != ""}
|
{(getText (_hitpointsCfg >> "visual")) != ""}
|
||||||
) then {
|
) then {
|
||||||
_armorComponent = getText (_hitPointsCfg >> "armorComponent");
|
_armorComponent = getText (_hitpointsCfg >> "armorComponent");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((_selection == "") && {_armorComponent == ""}) then {
|
if ((_selection == "") && {_armorComponent == ""}) then {
|
||||||
TRACE_3("Skipping no selection OR armor component",_hitPoint,_forEachIndex,_selection);
|
TRACE_3("Skipping no selection OR armor component",_hitpoint,_forEachIndex,_selection);
|
||||||
|
/*#ifdef DEBUG_MODE_FULL
|
||||||
|
systemChat format ["Skipping no selection OR armor component, hitpoint %1, index %2, selection %3", _hitpoint, _forEachIndex, _selection];
|
||||||
|
#endif*/
|
||||||
_indexesToIgnore pushBack _forEachIndex;
|
_indexesToIgnore pushBack _forEachIndex;
|
||||||
_processedSelections pushBack _selection;
|
_processedSelections pushBack _selection;
|
||||||
continue
|
continue
|
||||||
};
|
};
|
||||||
|
|
||||||
if !(getText (_vehCfg >> "HitPoints" >> _hitPoint >> "depends") in ["", "0"]) then {
|
if !(getText (_vehCfg >> "HitPoints" >> _hitpoint >> "depends") in ["", "0"]) then {
|
||||||
// Caches depends hitpoints and their parents
|
// Caches depends hitpoints and their parents
|
||||||
private _parentHitPoint = getText (_vehCfg >> "HitPoints" >> _hitPoint >> "depends");
|
private _parentHitPoint = getText (_vehCfg >> "HitPoints" >> _hitpoint >> "depends");
|
||||||
private _parentHitPointIndex = _hitPoints findIf {_x == _parentHitPoint};
|
private _parentHitPointIndex = _hitPoints findIf {_x == _parentHitPoint};
|
||||||
|
|
||||||
if (_parentHitPointIndex != -1) then {
|
if (_parentHitPointIndex != -1) then {
|
||||||
_dependsIndexMap set [_forEachIndex, _parentHitPointIndex];
|
_dependsIndexMap set [_forEachIndex, _parentHitPointIndex];
|
||||||
TRACE_3("Depends hitpoint and parent index",_hitPoint,_forEachIndex,_parentHitPoint);
|
TRACE_3("Depends hitpoint and parent index",_hitpoint,_forEachIndex,_parentHitPoint);
|
||||||
} else {
|
} else {
|
||||||
// Multiple/Complex parents or broken parents
|
// Multiple/Complex parents or broken parents
|
||||||
_indexesToIgnore pushBack _forEachIndex;
|
_indexesToIgnore pushBack _forEachIndex;
|
||||||
@ -146,15 +155,15 @@ private _complexDependsMap = createHashMap;
|
|||||||
} forEachReversed _parentHitPoints;
|
} forEachReversed _parentHitPoints;
|
||||||
|
|
||||||
if (_validComplexHitPoint || _parentHitPoint == "total") then {
|
if (_validComplexHitPoint || _parentHitPoint == "total") then {
|
||||||
TRACE_3("Skipping depends and setting complex parent",_hitPoint,_forEachIndex,_parentHitPoint);
|
TRACE_3("Skipping depends and setting complex parent",_hitpoint,_forEachIndex,_parentHitPoint);
|
||||||
_complexDependsMap set [_forEachIndex, [_parentHitPoint, _parentHitPoints]];
|
_complexDependsMap set [_forEachIndex, [_parentHitPoint, _parentHitPoints]];
|
||||||
_dependsIndexMap set [_forEachIndex, _parentHitPointIndex];
|
_dependsIndexMap set [_forEachIndex, _parentHitPointIndex];
|
||||||
} else {
|
} else {
|
||||||
TRACE_3("Skipping depends with broken complex parent",_hitPoint,_forEachIndex,_parentHitPoint);
|
TRACE_3("Skipping depends with broken complex parent",_hitpoint,_forEachIndex,_parentHitPoint);
|
||||||
private _groupIndex = _hitPointGroups findIf {_x # 0 == _hitPoint};
|
private _groupIndex = _hitpointGroups findIf {_x # 0 == _hitpoint};
|
||||||
if (_groupIndex != -1) then {
|
if (_groupIndex != -1) then {
|
||||||
ERROR_2("[%1] hitpoint [%2] is both a group-parent and an ignored depends and will be unrepairable",_type,_hitPoint);
|
ERROR_2("[%1] hitpoint [%2] is both a group-parent and an ignored depends and will be unrepairable",_type,_hitpoint);
|
||||||
ERROR_1("group: %1",_hitPointGroups # _groupIndex);
|
ERROR_1("group: %1",_hitpointGroups # _groupIndex);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -162,8 +171,11 @@ private _complexDependsMap = createHashMap;
|
|||||||
continue
|
continue
|
||||||
};
|
};
|
||||||
|
|
||||||
if (ANY_OF(_hitpointGroups,ANY_OF(_x select 1,_x == _hitpoint))) then {
|
if (ANY_OF(_hitpointGroups,ANY_OF(_x select 1,_x == _hitpoint))) then { // skip child hitpoints
|
||||||
TRACE_3("Skipping child hitpoint",_hitPoint,_forEachIndex,_selection);
|
TRACE_3("Skipping child hitpoint",_hitpoint,_forEachIndex,_selection);
|
||||||
|
/*#ifdef DEBUG_MODE_FULL
|
||||||
|
systemChat format ["Skipping child hitpoint, hitpoint %1, index %2, selection %3", _hitpoint, _forEachIndex, _selection];
|
||||||
|
#endif*/
|
||||||
_indexesToIgnore pushBack _forEachIndex;
|
_indexesToIgnore pushBack _forEachIndex;
|
||||||
_processedSelections pushBack _selection;
|
_processedSelections pushBack _selection;
|
||||||
continue
|
continue
|
||||||
@ -173,6 +185,6 @@ private _complexDependsMap = createHashMap;
|
|||||||
} forEach _hitSelections;
|
} forEach _hitSelections;
|
||||||
|
|
||||||
_initializedClasses set [_type, [_indexesToIgnore, _dependsIndexMap, _complexDependsMap]];
|
_initializedClasses set [_type, [_indexesToIgnore, _dependsIndexMap, _complexDependsMap]];
|
||||||
SETMVAR(GVAR(ignoredAndDependsInitializedClasses),_initializedClasses);
|
missionNamespace setVariable [QGVAR(hitPointsToIgnoreInitializedClasses), _initializedClasses];
|
||||||
|
|
||||||
[_indexesToIgnore, _dependsIndexMap, _complexDependsMap]
|
[_indexesToIgnore, _dependsIndexMap, _complexDependsMap]
|
||||||
|
@ -107,7 +107,7 @@ if !(_return && alive _target) exitWith {false};
|
|||||||
|
|
||||||
//Claim required objects
|
//Claim required objects
|
||||||
{
|
{
|
||||||
TRACE_2("Claiming",_x,typeOf _x);
|
TRACE_2("Claiming",_x,(typeOf _x));
|
||||||
[_caller, _x, false] call EFUNC(common,claim);
|
[_caller, _x, false] call EFUNC(common,claim);
|
||||||
} forEach _claimObjectsAvailable;
|
} forEach _claimObjectsAvailable;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ if (!isNil "_weaponSelect") then {
|
|||||||
|
|
||||||
//Unclaim repair objects:
|
//Unclaim repair objects:
|
||||||
{
|
{
|
||||||
TRACE_2("Releasing",_x,typeOf _x);
|
TRACE_2("Releasing",_x,(typeOf _x));
|
||||||
[objNull, _x, false] call EFUNC(common,claim);
|
[objNull, _x, false] call EFUNC(common,claim);
|
||||||
} forEach _claimedObjects;
|
} forEach _claimedObjects;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ if (!isNil "_weaponSelect") then {
|
|||||||
|
|
||||||
//Unclaim repair objects:
|
//Unclaim repair objects:
|
||||||
{
|
{
|
||||||
TRACE_2("Releasing",_x,typeOf _x);
|
TRACE_2("Releasing",_x,(typeOf _x));
|
||||||
[objNull, _x, false] call EFUNC(common,claim);
|
[objNull, _x, false] call EFUNC(common,claim);
|
||||||
} forEach _claimedObjects;
|
} forEach _claimedObjects;
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ params ["_vehicle", "_damage", ["_useEffects", false]];
|
|||||||
TRACE_2("params",_vehicle,_damage);
|
TRACE_2("params",_vehicle,_damage);
|
||||||
|
|
||||||
// can't execute all commands if the vehicle isn't local. exit here.
|
// can't execute all commands if the vehicle isn't local. exit here.
|
||||||
if !(local _vehicle) exitWith {ERROR_1("Vehicle Not Local %1",_vehicle);};
|
if !(local _vehicle) exitWith {};
|
||||||
|
|
||||||
// save array with damage values of all hitpoints
|
// save array with damage values of all hitpoints
|
||||||
(getAllHitPointsDamage _vehicle) params ["", "", ["_damageValues", []]];
|
(getAllHitPointsDamage _vehicle) params [["_allHitPoints", []], ["_allHitPointsSelections", []], ["_allHitPointDamages", []]];
|
||||||
|
|
||||||
// set damage of the vehicle
|
// set damage of the vehicle
|
||||||
private _damageDisabled = !isDamageAllowed _vehicle;
|
private _damageDisabled = !isDamageAllowed _vehicle;
|
||||||
@ -37,7 +37,7 @@ _vehicle setDamage [_damage, _useEffects];
|
|||||||
// restore original hitpoint damage values
|
// restore original hitpoint damage values
|
||||||
{
|
{
|
||||||
_vehicle setHitIndex [_forEachIndex, _x];
|
_vehicle setHitIndex [_forEachIndex, _x];
|
||||||
} forEach _damageValues;
|
} forEach _allHitPointDamages;
|
||||||
|
|
||||||
// normalize hitpoints
|
// normalize hitpoints
|
||||||
[_vehicle] call FUNC(normalizeHitPoints);
|
[_vehicle] call FUNC(normalizeHitPoints);
|
||||||
|
Loading…
Reference in New Issue
Block a user