ACE3/addons/medical/functions/fnc_handleIncapacitation.sqf
ulteq fa77fb7194 Various fixes:
* Fixed medication (morphine, epinephrine, ...)
* Fixed CPR
* Improved heart rate simulation
* Removed deprecated ace settings
2016-12-06 17:26:11 +01:00

46 lines
1.0 KiB
Plaintext

/*
* 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 _painLevel = [_unit] call FUNC(getPainLevel);
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 ((_painLevel >= PAIN_UNCONSCIOUS) && {random 1 < 0.1}) then {
[QGVAR(CriticalInjury), _unit] call CBA_fnc_localEvent;
};