2018-07-30 09:22:14 +00:00
|
|
|
#include "script_component.hpp"
|
2015-02-08 09:01:32 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
2018-08-25 15:40:22 +00:00
|
|
|
* Marks a unit as in cardiac arrest and sets heart rate to 0.
|
|
|
|
* Will put the unit in an unconscious state if not already.
|
2019-08-06 13:10:33 +00:00
|
|
|
* For Internal Use: Called from the state machine entered/leftState funcs.
|
2015-02-07 23:08:36 +00:00
|
|
|
*
|
2015-02-08 09:01:32 +00:00
|
|
|
* Arguments:
|
|
|
|
* 0: The unit that will be put in cardiac arrest state <OBJECT>
|
2019-08-06 13:10:33 +00:00
|
|
|
* 1: Set CardiacArrest <BOOL>
|
2015-02-08 09:01:32 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Return Value:
|
2015-08-22 17:47:23 +00:00
|
|
|
* None
|
2015-02-08 09:01:32 +00:00
|
|
|
*
|
2019-08-06 13:10:33 +00:00
|
|
|
* Example:
|
2019-10-12 14:47:57 +00:00
|
|
|
* [player, true] call ace_medical_status_fnc_setCardiacArrestState
|
2019-08-06 13:10:33 +00:00
|
|
|
*
|
2018-08-25 15:40:22 +00:00
|
|
|
* Public: No
|
2015-02-07 23:08:36 +00:00
|
|
|
*/
|
|
|
|
|
2018-08-25 15:40:22 +00:00
|
|
|
params ["_unit", "_active"];
|
2019-10-12 14:47:57 +00:00
|
|
|
TRACE_2("setCardiacArrestState",_unit,_active);
|
2015-02-07 23:08:36 +00:00
|
|
|
|
2018-08-25 15:40:22 +00:00
|
|
|
// No change to make
|
2019-08-06 13:10:33 +00:00
|
|
|
if (_active isEqualTo IN_CRDC_ARRST(_unit)) exitWith { TRACE_2("no change",_active,IN_CRDC_ARRST(_unit)); };
|
2016-12-06 16:26:11 +00:00
|
|
|
|
2018-08-25 15:40:22 +00:00
|
|
|
// No heart rate in cardiac arrest, low heart rate if revived
|
|
|
|
_unit setVariable [VAR_CRDC_ARRST, _active, true];
|
|
|
|
_unit setVariable [VAR_HEART_RATE, [40, 0] select _active, true];
|
2015-02-07 23:08:36 +00:00
|
|
|
|
2020-02-04 11:17:25 +00:00
|
|
|
// Cardiac arrest is an extension of unconsciousness, but only set when entering Cardiac arrest
|
|
|
|
if (_active) then {
|
|
|
|
[_unit, true] call FUNC(setUnconsciousState);
|
|
|
|
};
|
2015-02-07 23:08:36 +00:00
|
|
|
|
2018-08-25 15:40:22 +00:00
|
|
|
["ace_cardiacArrest", [_unit, _active]] call CBA_fnc_localEvent;
|