fixed undefined _selectionName variable #289

This commit is contained in:
Glowbal 2015-04-03 08:48:10 +02:00
parent ffcc01ef74
commit 368002cc79

View File

@ -24,10 +24,10 @@
#define ARMDAMAGETRESHOLD2 1.7
#define UNCONSCIOUSNESSTRESHOLD 0.7
private ["_unit", "_selection", "_damage", "_shooter", "_projectile", "_damageReturn"];
private ["_unit", "_selectionName", "_damage", "_shooter", "_projectile", "_damageReturn"];
_unit = _this select 0;
_selection = _this select 1;
_selectionName = _this select 1;
_damage = _this select 2;
_shooter = _this select 3;
_projectile = _this select 4;
@ -51,8 +51,8 @@ _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"];
_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"];
_newDamage = _damageReturn - (damage _unit);
if (_selection in _hitSelections) then {
_newDamage = _damageReturn - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selection)));
if (_selectionName in _hitSelections) then {
_newDamage = _damageReturn - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName)));
};
_damageReturn = _damageReturn - _newDamage;
@ -101,7 +101,7 @@ if (_selectionName != "" and !(_unit getVariable QGVAR(isFalling))) then {
};
// Get rid of double structural damage (seriously arma, what the fuck?)
if (_selection == "") then {
if (_selectionName == "") then {
_cache_structDamage = _unit getVariable QGVAR(structDamage);
if (_newDamage > _cache_structDamage) then {
_unit setVariable [QGVAR(structDamage), _newDamage];
@ -128,7 +128,7 @@ if (_selection == "") then {
}, [_unit], 2, 0.1] call EFUNC(common,waitAndExecute);
if (_selection == "") then {
if (_selectionName == "") then {
_damageReturn = _damageReturn + (_unit getVariable QGVAR(structDamage));
} else {
_damageReturn = _damageReturn + _newDamage;
@ -170,7 +170,7 @@ if (_armdamage >= ARMDAMAGETRESHOLD1) then {
// Set Pain
if (_selection == "") then {
if (_selectionName == "") then {
_pain = _unit getVariable [QGVAR(pain), 0];
_pain = _pain + _newDamage * (1 - (_unit getVariable [QGVAR(morphine), 0]));
_unit setVariable [QGVAR(pain), _pain min 1, true];
@ -178,7 +178,7 @@ if (_selection == "") then {
// Unconsciousness
if (_selection == "" and
if (_selectionName == "" and
_damageReturn >= UNCONSCIOUSNESSTRESHOLD and
_damageReturn < 1 and
!(_unit getVariable ["ACE_isUnconscious", False]