2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-11-07 21:21:07 +00:00
|
|
|
/*
|
|
|
|
* Author: BaerMitUmlaut
|
2018-08-25 15:40:22 +00:00
|
|
|
* Handles a unit entering cardiac arrest (calls for a status update).
|
|
|
|
* Sets required variables for countdown timer until death.
|
2016-11-07 21:21:07 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The Unit <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
2019-03-30 16:07:54 +00:00
|
|
|
* Example:
|
|
|
|
* [player] call ace_medical_statemachine_fnc_enteredStateCardiacArrest
|
|
|
|
*
|
2016-11-07 21:21:07 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
2016-12-05 20:34:20 +00:00
|
|
|
|
2016-11-07 21:21:07 +00:00
|
|
|
params ["_unit"];
|
2022-03-07 18:28:51 +00:00
|
|
|
if (isNull _unit || {!isNil {_unit getVariable QEGVAR(medical,causeOfDeath)}}) exitWith {
|
|
|
|
WARNING_1("enteredStateCardiacArrest: State transition on dead or null unit - %1",_unit);
|
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
|
2018-04-18 22:25:44 +00:00
|
|
|
// 10% possible variance in cardiac arrest time
|
2018-08-11 10:40:06 +00:00
|
|
|
private _time = GVAR(cardiacArrestTime);
|
2019-06-28 00:01:20 +00:00
|
|
|
_time = _time + _time * random [-0.1, 0, 0.1];
|
2016-11-15 13:52:09 +00:00
|
|
|
|
2019-06-28 00:01:20 +00:00
|
|
|
_unit setVariable [QGVAR(cardiacArrestTimeLeft), _time];
|
|
|
|
_unit setVariable [QGVAR(cardiacArrestTimeLastUpdate), CBA_missionTime];
|
|
|
|
|
|
|
|
TRACE_3("enteredStateCardiacArrest",_unit,_time,CBA_missionTime);
|
2016-12-05 20:34:20 +00:00
|
|
|
|
2018-08-25 15:40:22 +00:00
|
|
|
// Update the unit status to reflect cardiac arrest
|
2019-10-12 14:47:57 +00:00
|
|
|
[_unit, true] call EFUNC(medical_status,setCardiacArrestState);
|