mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
add some more functions to engine component
This commit is contained in:
parent
1196cbb210
commit
77f21e9441
@ -2,4 +2,6 @@
|
||||
PREP(handleDamage);
|
||||
PREP(playInjuredSound);
|
||||
PREP(damageBodyPart);
|
||||
PREP(setLimping);
|
||||
PREP(updatePainSway);
|
||||
PREP(setStructuralDamage);
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Selection, can be "Head", "Body", "Arms" or "Legs" <STRING>
|
||||
* 2: Damage (optional, default: 1) <BOOLEAN>
|
||||
* 2: Damage (optional, default: true) <BOOLEAN>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@ -29,7 +29,7 @@ if (!local _unit) exitWith {
|
||||
ACE_LOGERROR("Unit not local or null");
|
||||
};
|
||||
|
||||
_damage = [0, 0.99] select _damage;
|
||||
_damage = [0, 0.495] select _damage;
|
||||
|
||||
switch (toLower _selection) do {
|
||||
case ("head"): {
|
||||
@ -39,9 +39,9 @@ switch (toLower _selection) do {
|
||||
_unit setHitPointDamage ["HitBody", _damage];
|
||||
};
|
||||
case ("arms"): {
|
||||
_unit setHitPointDamage ["HitHands", _damage];
|
||||
_unit setHitPointDamage ["HitHands", _damage + (_unit getVariable [QGVAR(painSway), 0])];
|
||||
};
|
||||
case ("legs"): {
|
||||
_unit setHitPointDamage ["HitLegs", _damage];
|
||||
_unit setHitPointDamage ["HitLegs", _damage + ([0, LIMPING_MIN_DAMAGE] select (_unit getVariable [QGVAR(isLimping), false]))];
|
||||
};
|
||||
};
|
||||
|
29
addons/medical_engine/functions/fnc_setLimping.sqf
Normal file
29
addons/medical_engine/functions/fnc_setLimping.sqf
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Forces a unit to limp or not.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Unit <OBJECT>
|
||||
* 1: Limping (optional, default: true) <BOOLEAN>
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Example:
|
||||
* [player, true] call ace_medical_engine_fnc_setLimping
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params [["_unit", objNull, [objNull]], ["_isLimping", true, [false]]];
|
||||
|
||||
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];
|
32
addons/medical_engine/functions/fnc_updatePainSway.sqf
Normal file
32
addons/medical_engine/functions/fnc_updatePainSway.sqf
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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];
|
@ -42,3 +42,8 @@
|
||||
#define PRIORITY_RIGHT_ARM (1 + random 1)
|
||||
#define PRIORITY_LEFT_LEG (1 + random 1)
|
||||
#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 LIMPING_MIN_DAMAGE 0.5
|
||||
|
Loading…
Reference in New Issue
Block a user