Make use of new global variables for selections and hitpoints

This commit is contained in:
Glowbal 2015-04-11 22:31:38 +02:00
parent 6cc115a628
commit 97fa40b4c1

View File

@ -44,13 +44,9 @@ if (diag_frameno > (_unit getVariable [QGVAR(frameNo), -3]) + 2) then {
_unit setVariable [QGVAR(preventDeath), false];
};
_hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"];
_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
_newDamage = _damage - (damage _unit);
if (_selectionName in _hitSelections) then {
_newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName)));
if (_selectionName in GVAR(SELECTIONS)) then {
_newDamage = _damage - (_unit getHitPointDamage (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName)));
};
_damage = _damage - _newDamage;
@ -61,7 +57,7 @@ if (((velocity _unit) select 2 < -5) and (vehicle _unit == _unit)) then {
_unit setVariable [QGVAR(isFalling), true];
};
if (_unit getVariable [QGVAR(isFalling), false] and !(_selectionName in ["", "leg_l", "leg_r"])) exitWith {
(_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName))) max 0.01;
(_unit getHitPointDamage (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName))) max 0.01;
};
if (_unit getVariable [QGVAR(isFalling), false]) then {
_newDamage = _newDamage * 0.7;
@ -85,12 +81,12 @@ if (_selectionName != "" and !(_unit getVariable QGVAR(isFalling))) then {
// Make entry unfindable
_cache_projectiles set [_index, objNull];
_cache_projectiles pushBack _projectile;
_cache_hitpoints pushBack (_hitPoints select (_hitSelections find _selectionName));
_cache_hitpoints pushBack (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName));
_cache_damages pushBack _newDamage;
};
} else {
_cache_projectiles pushBack _projectile;
_cache_hitpoints pushBack (_hitPoints select (_hitSelections find _selectionName));
_cache_hitpoints pushBack (GVAR(HITPOINTS) select (GVAR(SELECTIONS) find _selectionName));
_cache_damages pushBack _newDamage;
};
_unit setVariable [QGVAR(projectiles), _cache_projectiles];