From 56c77fed94a929a6aceacb93ea07da6485ccfdaf Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 6 Oct 2016 23:44:14 +0200 Subject: [PATCH] prep for new pain aim sway method --- addons/medical_engine/XEH_PREP.hpp | 1 - .../functions/fnc_damageBodyPart.sqf | 4 +-- .../functions/fnc_setLimping.sqf | 14 +++++++++- .../functions/fnc_setPainSway.sqf | 27 ------------------- addons/medical_engine/script_component.hpp | 3 +-- 5 files changed, 16 insertions(+), 33 deletions(-) delete mode 100644 addons/medical_engine/functions/fnc_setPainSway.sqf diff --git a/addons/medical_engine/XEH_PREP.hpp b/addons/medical_engine/XEH_PREP.hpp index 2c949d9360..9e0032e118 100644 --- a/addons/medical_engine/XEH_PREP.hpp +++ b/addons/medical_engine/XEH_PREP.hpp @@ -3,6 +3,5 @@ PREP(handleDamage); PREP(playInjuredSound); PREP(damageBodyPart); PREP(setLimping); -PREP(setPainSway); PREP(setStructuralDamage); PREP(setUnconsciousAnim); diff --git a/addons/medical_engine/functions/fnc_damageBodyPart.sqf b/addons/medical_engine/functions/fnc_damageBodyPart.sqf index 270495ffe8..9b1ba523ec 100644 --- a/addons/medical_engine/functions/fnc_damageBodyPart.sqf +++ b/addons/medical_engine/functions/fnc_damageBodyPart.sqf @@ -29,7 +29,7 @@ if (!local _unit) exitWith { ERROR("Unit not local or null"); }; -_damage = [0, 0.495] select _damage; +_damage = [0, DAMAGED_MIN_THRESHOLD] select _damage; switch (toLower _selection) do { case ("head"): { @@ -39,7 +39,7 @@ switch (toLower _selection) do { _unit setHitPointDamage ["HitBody", _damage]; }; case ("arms"): { - _unit setHitPointDamage ["HitHands", _damage + ([0, PAIN_MAX_DAMAGE] select (_unit getVariable [QGVAR(isInPain), false]))]; + _unit setHitPointDamage ["HitHands", _damage]; }; case ("legs"): { _unit setHitPointDamage ["HitLegs", _damage + ([0, LIMPING_MIN_DAMAGE] select (_unit getVariable [QGVAR(isLimping), false]))]; diff --git a/addons/medical_engine/functions/fnc_setLimping.sqf b/addons/medical_engine/functions/fnc_setLimping.sqf index 489773d320..5f5a17e68f 100644 --- a/addons/medical_engine/functions/fnc_setLimping.sqf +++ b/addons/medical_engine/functions/fnc_setLimping.sqf @@ -24,4 +24,16 @@ if (!local _unit) exitWith { _unit setVariable [QGVAR(isLimping), _isLimping, true]; -[_unit, "Legs", _unit getHitPointDamage "HitLegs" >= DAMAGED_MIN_THRESHOLD + LIMPING_MIN_DAMAGE || _unit getHitPointDamage "HitLegs" <= DAMAGED_MIN_THRESHOLD] call FUNC(damageBodyPart); +if (_isLimping) then { + if (_unit getHitPointDamage "HitLegs" >= DAMAGED_MIN_THRESHOLD && {_unit getHitPointDamage "HitLegs" != LIMPING_MIN_DAMAGE}) then { + [_unit, "Legs", true] call FUNC(damageBodyPart); + } else { + [_unit, "Legs", false] call FUNC(damageBodyPart); + }; +} else { + if (_unit getHitPointDamage "HitLegs" >= DAMAGED_MIN_THRESHOLD && {_unit getHitPointDamage "HitLegs" != LIMPING_MIN_DAMAGE}) then { + [_unit, "Legs", true] call FUNC(damageBodyPart); + } else { + [_unit, "Legs", false] call FUNC(damageBodyPart); + }; +}; diff --git a/addons/medical_engine/functions/fnc_setPainSway.sqf b/addons/medical_engine/functions/fnc_setPainSway.sqf deleted file mode 100644 index 8da6b81f2b..0000000000 --- a/addons/medical_engine/functions/fnc_setPainSway.sqf +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Author: commy2 - * Updates weapon sway caused by pain. - * - * Arguments: - * 0: Unit - * 1: In pain (optional, default: true) - * - * Return Value: - * None - * - * Example: - * [player, true] call ace_medical_engine_fnc_setPainSway - * - * Public: No - */ -#include "script_component.hpp" - -params [["_unit", objNull, [objNull]], ["_isInPain", true, [false]]]; - -if (!local _unit) exitWith { - ERROR("Unit not local or null"); -}; - -_unit setVariable [GVAR(isInPain), _isInPain, true]; - -[_unit, "Arms", _unit getHitPointDamage "HitHands" >= DAMAGED_MIN_THRESHOLD] call FUNC(damageBodyPart); diff --git a/addons/medical_engine/script_component.hpp b/addons/medical_engine/script_component.hpp index 7f35049b5b..6cdaddc84b 100644 --- a/addons/medical_engine/script_component.hpp +++ b/addons/medical_engine/script_component.hpp @@ -44,6 +44,5 @@ #define PRIORITY_RIGHT_LEG (1 + random 1) // don't change, these reflect hard coded engine behaviour -#define DAMAGED_MIN_THRESHOLD 0.495 -#define PAIN_MAX_DAMAGE 0.345 +#define DAMAGED_MIN_THRESHOLD 0.45 #define LIMPING_MIN_DAMAGE 0.5