2018-07-20 21:23:48 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
/*
|
|
|
|
* Author: SilentSpike
|
2018-08-25 15:40:22 +00:00
|
|
|
* Handles a unit reaching the point of death (calls for a status update).
|
2018-07-20 21:23:48 +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_enteredStateDeath
|
|
|
|
*
|
2018-07-20 21:23:48 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_unit"];
|
2022-03-07 18:28:51 +00:00
|
|
|
if (isNull _unit || {!isNil {_unit getVariable QEGVAR(medical,causeOfDeath)}}) exitWith {
|
|
|
|
if ((_unit getVariable [QEGVAR(medical,causeOfDeath), ""]) == "#scripted") exitWith {};
|
|
|
|
WARNING_1("enteredStateDeath: State transition on dead or null unit - %1",_unit);
|
|
|
|
};
|
2018-07-20 21:23:48 +00:00
|
|
|
|
2019-09-05 20:56:14 +00:00
|
|
|
//IGNORE_PRIVATE_WARNING ["_thisOrigin", "_thisTransition"]; // vars provided by CBA_statemachine
|
2022-03-07 18:28:51 +00:00
|
|
|
TRACE_4("enteredStateDeath",_this,_thisOrigin,_thisTransition,CBA_missionTime);
|
2018-07-20 21:23:48 +00:00
|
|
|
|
2019-09-05 20:56:14 +00:00
|
|
|
private _causeOfDeath = format ["%1:%2", _thisOrigin, _thisTransition];
|
2021-11-15 15:31:56 +00:00
|
|
|
private _instigator = _unit getVariable [QEGVAR(medical,lastInstigator), objNull];
|
2018-07-20 21:23:48 +00:00
|
|
|
|
2021-11-15 15:31:56 +00:00
|
|
|
[_unit, _causeOfDeath, _instigator] call EFUNC(medical_status,setDead);
|