From 038ed5f23e2366da28a2e23aa30a161b29604a7f Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 3 Apr 2015 21:59:47 +0200 Subject: [PATCH] Removed deprecated returnDamage parameters --- addons/medical/functions/fnc_handleDamage.sqf | 5 ++-- .../functions/fnc_handleDamage_advanced.sqf | 3 +- .../functions/fnc_handleDamage_basic.sqf | 30 +++++++++---------- .../functions/fnc_handleDamage_caching.sqf | 5 ++-- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index e4f279392c..058598cf60 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -24,7 +24,6 @@ _damage = _this select 2; _shooter = _this select 3; _projectile = _this select 4; - if !(local _unit) exitWith {nil}; if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {}; @@ -40,11 +39,11 @@ if !(_selection in (_hitSelections + [""])) exitWith {0}; _damageReturn = _damage; if (GVAR(level) == 1) then { - _damageReturn = (_this + [_damageReturn]) call FUNC(handleDamage_basic); + _damageReturn = _this call FUNC(handleDamage_basic); }; if (GVAR(level) >= 2) then { - [_unit, _selection, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching); + [_unit, _selection, _damage, _source, _projectile] call FUNC(handleDamage_caching); if (_damageReturn > 0.9) then { diff --git a/addons/medical/functions/fnc_handleDamage_advanced.sqf b/addons/medical/functions/fnc_handleDamage_advanced.sqf index 1f943d98d0..751896be44 100644 --- a/addons/medical/functions/fnc_handleDamage_advanced.sqf +++ b/addons/medical/functions/fnc_handleDamage_advanced.sqf @@ -25,7 +25,6 @@ _selectionName = _this select 1; _amountOfDamage = _this select 2; _sourceOfDamage = _this select 3; _typeOfProjectile = _this select 4; -_returnDamage = _this select 5; // Most likely taking exessive fire damage. Lets exit. if (isNull _sourceOfDamage && (_selectionName == "head" || isBurning _unit) && _typeOfProjectile == "" && vehicle _unit == _unit) exitwith { @@ -63,4 +62,4 @@ if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then { }; }; -_returnDamage; +_amountOfDamage; diff --git a/addons/medical/functions/fnc_handleDamage_basic.sqf b/addons/medical/functions/fnc_handleDamage_basic.sqf index 3981a572d6..2986e1b2f7 100644 --- a/addons/medical/functions/fnc_handleDamage_basic.sqf +++ b/addons/medical/functions/fnc_handleDamage_basic.sqf @@ -24,15 +24,13 @@ #define ARMDAMAGETRESHOLD2 1.7 #define UNCONSCIOUSNESSTRESHOLD 0.7 -private ["_unit", "_selectionName", "_damage", "_shooter", "_projectile", "_damageReturn"]; +private ["_unit", "_selectionName", "_damage", "_shooter", "_projectile", "_damage"]; _unit = _this select 0; _selectionName = _this select 1; _damage = _this select 2; _shooter = _this select 3; _projectile = _this select 4; -_damageReturn = _this select 5; - // This is a new hit, reset variables. // Note: sometimes handleDamage spans over 2 or even 3 frames. @@ -50,12 +48,12 @@ if (diag_frameno > (_unit getVariable [QGVAR(frameNo), -3]) + 2) then { _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; -_newDamage = _damageReturn - (damage _unit); +_newDamage = _damage - (damage _unit); if (_selectionName in _hitSelections) then { - _newDamage = _damageReturn - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName))); + _newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName))); }; -_damageReturn = _damageReturn - _newDamage; +_damage = _damage - _newDamage; // Exclude falling damage to everything other than legs and reduce it overall. @@ -129,19 +127,19 @@ if (_selectionName == "") then { if (_selectionName == "") then { - _damageReturn = _damageReturn + (_unit getVariable QGVAR(structDamage)); + _damage = _damage + (_unit getVariable QGVAR(structDamage)); } else { - _damageReturn = _damageReturn + _newDamage; + _damage = _damage + _newDamage; }; // Leg Damage _legdamage = (_unit getHitPointDamage "HitLeftLeg") + (_unit getHitPointDamage "HitRightLeg"); if (_selectionName == "leg_l") then { - _legdamage = _damageReturn + (_unit getHitPointDamage "HitRightLeg"); + _legdamage = _damage + (_unit getHitPointDamage "HitRightLeg"); }; if (_selectionName == "leg_r") then { - _legdamage = (_unit getHitPointDamage "HitLeftLeg") + _damageReturn; + _legdamage = (_unit getHitPointDamage "HitLeftLeg") + _damage; }; if (_legdamage >= LEGDAMAGETRESHOLD1) then { @@ -155,10 +153,10 @@ if (_legdamage >= LEGDAMAGETRESHOLD1) then { // Arm Damage _armdamage = (_unit getHitPointDamage "HitLeftArm") + (_unit getHitPointDamage "HitRightArm"); if (_selectionName == "hand_l") then { - _armdamage = _damageReturn + (_unit getHitPointDamage "HitRightArm"); + _armdamage = _damage + (_unit getHitPointDamage "HitRightArm"); }; if (_selectionName == "hand_r") then { - _armdamage = (_unit getHitPointDamage "HitLeftArm") + _damageReturn; + _armdamage = (_unit getHitPointDamage "HitLeftArm") + _damage; }; if (_armdamage >= ARMDAMAGETRESHOLD1) then { @@ -179,15 +177,15 @@ if (_selectionName == "") then { // Unconsciousness if (_selectionName == "" and - _damageReturn >= UNCONSCIOUSNESSTRESHOLD and - _damageReturn < 1 and + _damage >= UNCONSCIOUSNESSTRESHOLD and + _damage < 1 and !(_unit getVariable ["ACE_isUnconscious", False] )) then { if (_unit getVariable [QGVAR(allowUnconscious), ([_unit] call EFUNC(common,isPlayer)) or random 1 > 0.3]) then { [_unit, true] call FUNC(setUnconscious); } else { - _damageReturn = 1; + _damage = 1; }; }; -_damageReturn +_damage diff --git a/addons/medical/functions/fnc_handleDamage_caching.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf index 1657d65b25..ddd0b6c920 100644 --- a/addons/medical/functions/fnc_handleDamage_caching.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -24,7 +24,6 @@ _selectionName = _this select 1; _damage = _this select 2; _source = _this select 3; _projectile = _this select 4; -_returnDamage = _this select 5; _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; @@ -128,14 +127,14 @@ if (_selectionName != "") then { _cache_projectiles pushBack _projectile; _cache_hitpoints pushBack (_hitPoints select (_hitSelections find _selectionName)); _cache_damages pushBack _newDamage; - _cache_params pushBack [_unit, _selectionName, _damage, _source, _projectile, _returnDamage]; + _cache_params pushBack [_unit, _selectionName, _damage, _source, _projectile]; }; } else { // This is an unhandled projectile _cache_projectiles pushBack _projectile; _cache_hitpoints pushBack (_hitPoints select (_hitSelections find _selectionName)); _cache_damages pushBack _newDamage; - _cache_params pushBack [_unit, _selectionName, _damage, _source, _projectile, _returnDamage]; + _cache_params pushBack [_unit, _selectionName, _damage, _source, _projectile]; }; };