ACE3/addons/medical_statemachine/functions/fnc_enteredStateCardiacArrest.sqf

35 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

#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
*
2019-03-30 16:07:54 +00:00
* Example:
* [player] call ace_medical_statemachine_fnc_enteredStateCardiacArrest
*
* Public: No
*/
2016-12-05 20:34:20 +00:00
params ["_unit"];
if (isNull _unit || {!isNil {_unit getVariable QEGVAR(medical,causeOfDeath)}}) exitWith {
WARNING_1("enteredStateCardiacArrest: State transition on dead or null unit - %1",_unit);
};
// 10% possible variance in cardiac arrest time
private _time = GVAR(cardiacArrestTime);
_time = _time + _time * random [-0.1, 0, 0.1];
_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
// Update the unit status to reflect cardiac arrest
[_unit, true] call EFUNC(medical_status,setCardiacArrestState);