ACE3/addons/medical/functions/fnc_handleIncapacitation.sqf

46 lines
1.0 KiB
Plaintext
Raw Normal View History

2016-12-05 20:34:20 +00:00
/*
* Author: Ruthberg
* Handle incapacitation due to damage and pain
*
* Arguments:
* 0: The Unit <OBJECT>
*
* ReturnValue:
* nothing
*
* Public: No
*/
#include "script_component.hpp"
params ["_unit"];
private _pain = _unit getVariable [QGVAR(pain), 0];
private _headDamage = 0;
private _bodyDamage = 0;
{
_x params ["", "", "_bodyPart", "", "", "_damage"];
switch (_bodyPart) do {
case 0: {
_headDamage = _headDamage + _damage;
};
case 1: {
if (_damage > PENETRATION_THRESHOLD) then {
_bodyDamage = _bodyDamage + _damage;
};
};
};
} forEach (_unit getVariable [QGVAR(openWounds), []]);
// todo: use an ace settings for the thresholds
if (_headDamage > 0.50) then {
[QGVAR(CriticalInjury), _unit] call CBA_fnc_localEvent;
};
if (_bodyDamage > 1.05) then {
[QGVAR(CriticalInjury), _unit] call CBA_fnc_localEvent;
};
if ((_pain >= PAIN_UNCONSCIOUS) && {random 1 < 0.1}) then {
[QGVAR(CriticalInjury), _unit] call CBA_fnc_localEvent;
};