ACE3/addons/medical_statemachine/functions/fnc_enteredStateCardiacArrest.sqf
SilentSpike 24846e6f74
Make state change status updates consistent (#6538)
State transitions call respective functions in the status component where unit variables and status are actually handled.
2018-08-25 16:40:22 +01:00

27 lines
671 B
Plaintext

#include "script_component.hpp"
/*
* Author: BaerMitUmlaut
* Handles a unit entering cardiac arrest (calls for a status update).
* Sets required variables for countdown timer until death.
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
params ["_unit"];
// 10% possible variance in cardiac arrest time
private _time = GVAR(cardiacArrestTime);
_time = _time + random [_time*-0.1, 0, _time*0.1];
_unit setVariable [QGVAR(cardiacArrestTime), _time];
_unit setVariable [QGVAR(cardiacArrestStart), CBA_missionTime];
// Update the unit status to reflect cardiac arrest
[_unit, true] call EFUNC(medical_status,setCardiacArrest);