mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
simplify
This commit is contained in:
parent
77f21e9441
commit
bd98e44a94
@ -3,5 +3,5 @@ PREP(handleDamage);
|
||||
PREP(playInjuredSound);
|
||||
PREP(damageBodyPart);
|
||||
PREP(setLimping);
|
||||
PREP(updatePainSway);
|
||||
PREP(setPainSway);
|
||||
PREP(setStructuralDamage);
|
||||
|
@ -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]))];
|
||||
|
@ -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);
|
||||
|
27
addons/medical_engine/functions/fnc_setPainSway.sqf
Normal file
27
addons/medical_engine/functions/fnc_setPainSway.sqf
Normal 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);
|
@ -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];
|
Loading…
Reference in New Issue
Block a user