mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Apply suggestions from code review
Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
This commit is contained in:
parent
b8e93e2d28
commit
debeb1bb5d
@ -50,7 +50,7 @@ if (_hitPointNewDamage < _hitPointCurDamage) then {
|
||||
_parentHitpointNewDamage = (_parentHitpointCurDamage - 0.5) max _postRepairDamageMin;
|
||||
};
|
||||
_repairedHitpoints pushBack _parentIndex;
|
||||
TRACE_4("Repairing depends and parent", _vehicle, _hitPointIndex, _parentIndex, _parentHitpointNewDamage);
|
||||
TRACE_4("Repairing depends and parent",_vehicle,_hitPointIndex,_parentIndex,_parentHitpointNewDamage);
|
||||
[QGVAR(setVehicleHitPointDamage), [_vehicle, _parentIndex, _parentHitpointNewDamage], _vehicle] call CBA_fnc_targetEvent;
|
||||
_hitPointCurDamage = _parentHitpointNewDamage;
|
||||
};
|
||||
@ -76,7 +76,7 @@ if (isArray _hitpointGroupConfig) then {
|
||||
private _subPointCurDamage = _vehicle getHitIndex _hitPointIndex;
|
||||
private _subPointNewDamage = (_subPointCurDamage - 0.5) max _postRepairDamageMin;
|
||||
if (_subPointNewDamage < _subPointCurDamage) then {
|
||||
TRACE_3("repairing sub point", _vehicle, _subHitIndex, _subPointNewDamage);
|
||||
TRACE_3("repairing sub point",_vehicle,_subHitIndex,_subPointNewDamage);
|
||||
_repairedHitpoints pushBack _subHitIndex;
|
||||
[QGVAR(setVehicleHitPointDamage), [_vehicle, _subHitIndex, _subPointNewDamage], _vehicle] call CBA_fnc_targetEvent;
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ params ["_vehicle"];
|
||||
|
||||
private _type = typeOf _vehicle;
|
||||
TRACE_2("getSelectionsToIgnore",_vehicle,_type);
|
||||
private _initializedClasses = GETMVAR(GVAR(ignoredAndDependsInitializedClasses), createHashMap);
|
||||
private _initializedClasses = GETMVAR(GVAR(ignoredAndDependsInitializedClasses),createHashMap);
|
||||
if (_type in _initializedClasses) exitWith {
|
||||
TRACE_2("retrieved cached selections",_vehicle,_type);
|
||||
_initializedClasses get _type;
|
||||
@ -161,6 +161,6 @@ private _processedSelections = [];
|
||||
} forEach _hitSelections;
|
||||
|
||||
_initializedClasses set [_type, [_indexesToIgnore, _dependsIndexMap]];
|
||||
SETMVAR(GVAR(ignoredAndDependsInitializedClasses), _initializedClasses);
|
||||
SETMVAR(GVAR(ignoredAndDependsInitializedClasses),_initializedClasses);
|
||||
|
||||
[_indexesToIgnore, _dependsIndexMap]
|
||||
|
@ -26,6 +26,6 @@ if !(local _vehicle) exitWith {ERROR_1("Vehicle Not Local %1", _vehicle);};
|
||||
// apply normalized damage to all depends hitpoints
|
||||
{
|
||||
private _damage = _vehicle getHitIndex _y;
|
||||
TRACE_2("setting depends hitpoint", _x, _damage);
|
||||
TRACE_2("setting depends hitpoint",_x,_damage);
|
||||
_vehicle setHitIndex [_x, _damage];
|
||||
} forEach _dependsIndexMap;
|
||||
|
@ -31,7 +31,7 @@ if !(local _vehicle) exitWith {ERROR_1("Vehicle Not Local %1", _vehicle);};
|
||||
([_vehicle] call FUNC(getSelectionsToIgnore)) params ["_selectionsToIgnore", "_dependsIndexMap"];
|
||||
|
||||
// exit if the hitpoint is not valid
|
||||
if ((_hitPointIndex < 0) || {_hitPointIndex >= (count _hitSelections)}) exitWith {ERROR_2("NOT A VALID HITPOINT: %1-%2", _hitPointIndex,_vehicle);};
|
||||
if ((_hitPointIndex < 0) || {_hitPointIndex >= (count _hitSelections)}) exitWith {ERROR_2("NOT A VALID HITPOINT: %1-%2",_hitPointIndex,_vehicle);};
|
||||
|
||||
// save structural damage and sum of hitpoint damages
|
||||
private _damageOld = damage _vehicle;
|
||||
@ -40,7 +40,7 @@ private _realHitPointCount = 0;
|
||||
private _hitPointDamageSumOld = 0;
|
||||
private _hitPointDamageRepaired = 0; //positive for repairs : newSum = (oldSum - repaired)
|
||||
{
|
||||
if (!(_forEachIndex in _selectionsToIgnore) && isNil{_dependsIndexMap get _forEachIndex}) then {
|
||||
if (!(_forEachIndex in _selectionsToIgnore) && !(_forEachIndex in _dependsIndexMap)) then {
|
||||
_realHitPointCount = _realHitPointCount + 1;
|
||||
_hitPointDamageSumOld = _hitPointDamageSumOld + (_damageValues select _forEachIndex);
|
||||
if (_forEachIndex == _hitPointIndex) then {
|
||||
|
Loading…
Reference in New Issue
Block a user