prep for new pain aim sway method

This commit is contained in:
commy2 2016-10-06 23:44:14 +02:00
parent e9586ebccc
commit 56c77fed94
5 changed files with 16 additions and 33 deletions

View File

@ -3,6 +3,5 @@ PREP(handleDamage);
PREP(playInjuredSound); PREP(playInjuredSound);
PREP(damageBodyPart); PREP(damageBodyPart);
PREP(setLimping); PREP(setLimping);
PREP(setPainSway);
PREP(setStructuralDamage); PREP(setStructuralDamage);
PREP(setUnconsciousAnim); PREP(setUnconsciousAnim);

View File

@ -29,7 +29,7 @@ if (!local _unit) exitWith {
ERROR("Unit not local or null"); ERROR("Unit not local or null");
}; };
_damage = [0, 0.495] select _damage; _damage = [0, DAMAGED_MIN_THRESHOLD] select _damage;
switch (toLower _selection) do { switch (toLower _selection) do {
case ("head"): { case ("head"): {
@ -39,7 +39,7 @@ switch (toLower _selection) do {
_unit setHitPointDamage ["HitBody", _damage]; _unit setHitPointDamage ["HitBody", _damage];
}; };
case ("arms"): { case ("arms"): {
_unit setHitPointDamage ["HitHands", _damage + ([0, PAIN_MAX_DAMAGE] select (_unit getVariable [QGVAR(isInPain), false]))]; _unit setHitPointDamage ["HitHands", _damage];
}; };
case ("legs"): { case ("legs"): {
_unit setHitPointDamage ["HitLegs", _damage + ([0, LIMPING_MIN_DAMAGE] select (_unit getVariable [QGVAR(isLimping), false]))]; _unit setHitPointDamage ["HitLegs", _damage + ([0, LIMPING_MIN_DAMAGE] select (_unit getVariable [QGVAR(isLimping), false]))];

View File

@ -24,4 +24,16 @@ if (!local _unit) exitWith {
_unit setVariable [QGVAR(isLimping), _isLimping, true]; _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);
};
};

View File

@ -1,27 +0,0 @@
/*
* Author: commy2
* Updates weapon sway caused by pain.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: In pain (optional, default: true) <BOOLEAN>
*
* 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);

View File

@ -44,6 +44,5 @@
#define PRIORITY_RIGHT_LEG (1 + random 1) #define PRIORITY_RIGHT_LEG (1 + random 1)
// don't change, these reflect hard coded engine behaviour // don't change, these reflect hard coded engine behaviour
#define DAMAGED_MIN_THRESHOLD 0.495 #define DAMAGED_MIN_THRESHOLD 0.45
#define PAIN_MAX_DAMAGE 0.345
#define LIMPING_MIN_DAMAGE 0.5 #define LIMPING_MIN_DAMAGE 0.5