This commit is contained in:
commy2 2016-09-30 11:52:05 +02:00
parent 77f21e9441
commit bd98e44a94
5 changed files with 31 additions and 38 deletions

View File

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

View File

@ -39,7 +39,7 @@ switch (toLower _selection) do {
_unit setHitPointDamage ["HitBody", _damage];
};
case ("arms"): {
_unit setHitPointDamage ["HitHands", _damage + (_unit getVariable [QGVAR(painSway), 0])];
_unit setHitPointDamage ["HitHands", _damage + ([0, PAIN_MAX_DAMAGE] select (_unit getVariable [QGVAR(isInPain), false]))];
};
case ("legs"): {
_unit setHitPointDamage ["HitLegs", _damage + ([0, LIMPING_MIN_DAMAGE] select (_unit getVariable [QGVAR(isLimping), false]))];

View File

@ -22,8 +22,6 @@ if (!local _unit) exitWith {
ACE_LOGERROR("Unit not local or null");
};
private _damage = [0, LIMPING_MIN_DAMAGE] select _isLimping;
_unit setHitPointDamage ["HitLegs", _damage];
_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);

View File

@ -0,0 +1,27 @@
/*
* 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 {
ACE_LOGERROR("Unit not local or null");
};
_unit setVariable [GVAR(isInPain), _isInPain, true];
[_unit, "Arms", _unit getHitPointDamage "HitHands" >= DAMAGED_MIN_THRESHOLD] call FUNC(damageBodyPart);

View File

@ -1,32 +0,0 @@
/*
* Author: commy2
* Updates weapon sway caused by pain.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* player call ace_medical_engine_fnc_updatePainSway
*
* Public: No
*/
#include "script_component.hpp"
params [["_unit", objNull, [objNull]]];
if (!local _unit) exitWith {
ACE_LOGERROR("Unit not local or null");
};
private _damage = PAIN_MAX_DAMAGE * ((_unit getVariable [QEGVAR(medical,pain), 0]) min 1);
_unit setVariable [QGVAR(painSway), _damage];
if (_unit getHitPointDamage "HitHands" > DAMAGED_MIN_THRESHOLD) then {
_damage = _damage + DAMAGED_MIN_THRESHOLD;
};
_unit setHitPointDamage ["HitHands", _damage];