2017-06-17 23:28:16 +00:00
|
|
|
// Manual transitions applied to this statemachine
|
2018-08-12 09:14:48 +00:00
|
|
|
// - fnc_resetStateDefault on unit respawn
|
2016-06-30 21:43:25 +00:00
|
|
|
class ACE_Medical_StateMachine {
|
2019-03-26 03:49:53 +00:00
|
|
|
list = QUOTE(call EFUNC(common,getLocalUnits));
|
2016-11-29 11:35:26 +00:00
|
|
|
skipNull = 1;
|
2016-06-30 21:43:25 +00:00
|
|
|
class Default {
|
2018-07-16 21:25:54 +00:00
|
|
|
onState = QFUNC(handleStateDefault);
|
2016-06-30 21:43:25 +00:00
|
|
|
class Injury {
|
|
|
|
targetState = "Injured";
|
2018-08-11 10:40:06 +00:00
|
|
|
events[] = {QEGVAR(medical,injured), QEGVAR(medical,LoweredVitals)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
class CriticalInjuryOrVitals {
|
|
|
|
targetState = "Unconscious";
|
2018-07-15 13:00:16 +00:00
|
|
|
events[] = {QEGVAR(medical,CriticalInjury), QEGVAR(medical,CriticalVitals), QEGVAR(medical,knockOut)};
|
2017-06-05 16:42:46 +00:00
|
|
|
};
|
|
|
|
class FatalVitals {
|
|
|
|
targetState = "CardiacArrest";
|
2018-07-25 10:40:37 +00:00
|
|
|
events[] = {QEGVAR(medical,FatalVitals), QEGVAR(medical,Bleedout)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
class FatalInjury {
|
|
|
|
targetState = "FatalInjury";
|
2018-07-15 13:00:16 +00:00
|
|
|
events[] = {QEGVAR(medical,FatalInjury)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
class Injured {
|
2018-07-16 21:25:54 +00:00
|
|
|
onState = QFUNC(handleStateInjured);
|
2016-06-30 21:43:25 +00:00
|
|
|
class FullHeal {
|
|
|
|
targetState = "Default";
|
2018-07-15 13:00:16 +00:00
|
|
|
events[] = {QEGVAR(medical,FullHeal)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
class CriticalInjuryOrVitals {
|
|
|
|
targetState = "Unconscious";
|
2018-07-15 13:00:16 +00:00
|
|
|
events[] = {QEGVAR(medical,CriticalInjury), QEGVAR(medical,CriticalVitals), QEGVAR(medical,knockOut)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
class FatalVitals {
|
|
|
|
targetState = "CardiacArrest";
|
2018-07-25 10:40:37 +00:00
|
|
|
events[] = {QEGVAR(medical,FatalVitals), QEGVAR(medical,Bleedout)};
|
2016-11-07 21:21:07 +00:00
|
|
|
};
|
|
|
|
class FatalInjury {
|
|
|
|
targetState = "FatalInjury";
|
2018-07-15 13:00:16 +00:00
|
|
|
events[] = {QEGVAR(medical,FatalInjury)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
class Unconscious {
|
2018-07-16 21:25:54 +00:00
|
|
|
onState = QFUNC(handleStateUnconscious);
|
2022-03-07 18:28:51 +00:00
|
|
|
onStateEntered = QFUNC(enteredStateUnconscious);
|
2017-05-22 20:16:18 +00:00
|
|
|
class DeathAI {
|
|
|
|
targetState = "Dead";
|
2023-11-05 18:36:00 +00:00
|
|
|
condition = QUOTE(!(_this getVariable [ARR_2(QQGVAR(AIUnconsciousness),GVAR(AIUnconsciousness))]) && {!isPlayer _this});
|
2017-05-22 20:16:18 +00:00
|
|
|
};
|
2016-12-05 20:34:20 +00:00
|
|
|
class WakeUp {
|
2016-06-30 21:43:25 +00:00
|
|
|
targetState = "Injured";
|
2018-07-16 21:25:54 +00:00
|
|
|
condition = QEFUNC(medical_status,hasStableVitals);
|
2018-07-15 13:00:16 +00:00
|
|
|
events[] = {QEGVAR(medical,WakeUp)};
|
2019-10-12 14:47:57 +00:00
|
|
|
onTransition = QUOTE([ARR_2(_this,false)] call EFUNC(medical_status,setUnconsciousState));
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
class FatalTransitions {
|
2016-11-07 21:21:07 +00:00
|
|
|
targetState = "CardiacArrest";
|
2018-07-25 10:40:37 +00:00
|
|
|
events[] = {QEGVAR(medical,FatalVitals), QEGVAR(medical,Bleedout)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
class FatalInjury {
|
|
|
|
targetState = "FatalInjury";
|
2018-07-15 13:00:16 +00:00
|
|
|
events[] = {QEGVAR(medical,FatalInjury)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
};
|
|
|
|
class FatalInjury {
|
2019-09-10 04:30:56 +00:00
|
|
|
// Transition state for handling instant death from fatal injuries
|
2016-11-07 22:46:10 +00:00
|
|
|
// This state raises the next transition in the same frame
|
2018-07-16 21:25:54 +00:00
|
|
|
onStateEntered = QFUNC(enteredStateFatalInjury);
|
2016-11-09 18:01:55 +00:00
|
|
|
class SecondChance {
|
2018-07-15 13:00:16 +00:00
|
|
|
events[] = {QEGVAR(medical,FatalInjuryInstantTransition)};
|
2016-11-07 21:21:07 +00:00
|
|
|
targetState = "CardiacArrest";
|
2019-09-10 04:30:56 +00:00
|
|
|
condition = QFUNC(conditionSecondChance);
|
2018-07-16 21:25:54 +00:00
|
|
|
onTransition = QFUNC(transitionSecondChance);
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-09 18:01:55 +00:00
|
|
|
class Death {
|
2018-07-15 13:00:16 +00:00
|
|
|
events[] = {QEGVAR(medical,FatalInjuryInstantTransition)};
|
2016-06-30 21:43:25 +00:00
|
|
|
targetState = "Dead";
|
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
};
|
|
|
|
class CardiacArrest {
|
2019-06-28 00:01:20 +00:00
|
|
|
onState = QFUNC(handleStateCardiacArrest);
|
2018-07-16 21:25:54 +00:00
|
|
|
onStateEntered = QFUNC(enteredStateCardiacArrest);
|
|
|
|
onStateLeaving = QFUNC(leftStateCardiacArrest);
|
2017-06-18 10:43:39 +00:00
|
|
|
class DeathAI {
|
2019-09-10 04:30:56 +00:00
|
|
|
// If an AI unit reanimates, they will immediately die upon entering unconsciousness if AI Unconsciousness is disabled
|
|
|
|
// As a result, we immediately kill the AI unit since cardiac arrest is effectively useless for it
|
2017-06-18 10:43:39 +00:00
|
|
|
targetState = "Dead";
|
2019-09-10 04:30:56 +00:00
|
|
|
condition = QUOTE(!GVAR(AIUnconsciousness) && {!isPlayer _this});
|
2017-06-18 10:43:39 +00:00
|
|
|
};
|
2016-12-05 20:34:20 +00:00
|
|
|
class Timeout {
|
2016-06-30 21:43:25 +00:00
|
|
|
targetState = "Dead";
|
2018-07-18 18:13:25 +00:00
|
|
|
condition = QFUNC(conditionCardiacArrestTimer);
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-12-05 20:34:20 +00:00
|
|
|
class Reanimation {
|
2016-11-07 21:21:07 +00:00
|
|
|
targetState = "Unconscious";
|
2018-07-15 13:00:16 +00:00
|
|
|
events[] = {QEGVAR(medical,CPRSucceeded)};
|
2016-11-07 21:21:07 +00:00
|
|
|
};
|
2016-11-08 18:37:56 +00:00
|
|
|
class Execution {
|
|
|
|
targetState = "Dead";
|
2018-07-18 18:13:25 +00:00
|
|
|
condition = QFUNC(conditionExecutionDeath);
|
2018-07-15 13:00:16 +00:00
|
|
|
events[] = {QEGVAR(medical,FatalInjury)};
|
2016-11-08 18:37:56 +00:00
|
|
|
};
|
2018-07-25 10:40:37 +00:00
|
|
|
class Bleedout {
|
|
|
|
targetState = "Dead";
|
2020-11-10 16:06:45 +00:00
|
|
|
condition = QUOTE((GVAR(cardiacArrestBleedoutEnabled))); // wrap to ensure cba uses this as code and not a direct variable
|
2018-07-25 10:40:37 +00:00
|
|
|
events[] = {QEGVAR(medical,Bleedout)};
|
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
};
|
|
|
|
class Dead {
|
2018-07-20 21:23:48 +00:00
|
|
|
// When the unit is killed it's no longer handled by the statemachine
|
|
|
|
onStateEntered = QFUNC(enteredStateDeath);
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
};
|