ACE3/addons/medical_statemachine/Statemachine.hpp

113 lines
3.9 KiB
C++
Raw Normal View History

// Manual transitions applied to this statemachine
// - medical_fnc_handleRespawn:18
2016-06-30 21:43:25 +00:00
class ACE_Medical_StateMachine {
list = "allUnits select {local _x}";
skipNull = 1;
2016-06-30 21:43:25 +00:00
class Default {
onState = QFUNC(handleStateDefault);
2016-06-30 21:43:25 +00:00
class Injury {
targetState = "Injured";
2016-12-05 20:34:20 +00:00
events[] = {QGVAR(Injury)};
2016-06-30 21:43:25 +00:00
};
class CriticalInjuryOrVitals {
targetState = "Unconscious";
events[] = {QGVAR(CriticalInjury), QGVAR(CriticalVitals), QGVAR(knockOut)};
};
class FatalVitals {
targetState = "CardiacArrest";
events[] = {QGVAR(FatalVitals)};
2016-06-30 21:43:25 +00:00
};
class FatalInjury {
targetState = "FatalInjury";
2016-12-05 20:34:20 +00:00
events[] = {QGVAR(FatalInjury)};
2016-06-30 21:43:25 +00:00
};
};
class Injured {
onState = QFUNC(handleStateInjured);
2016-06-30 21:43:25 +00:00
class FullHeal {
targetState = "Default";
events[] = {QGVAR(FullHeal)};
2016-06-30 21:43:25 +00:00
};
class CriticalInjuryOrVitals {
targetState = "Unconscious";
events[] = {QGVAR(CriticalInjury), QGVAR(CriticalVitals), QGVAR(knockOut)};
2016-06-30 21:43:25 +00:00
};
class FatalVitals {
targetState = "CardiacArrest";
events[] = {QGVAR(FatalVitals)};
};
class FatalInjury {
targetState = "FatalInjury";
2016-12-05 20:34:20 +00:00
events[] = {QGVAR(FatalInjury)};
2016-06-30 21:43:25 +00:00
};
};
class Unconscious {
onState = QFUNC(handleStateUnconscious);
onStateEntered = QUOTE([ARR_2(_this,(true))] call FUNC(setUnconsciousStatemachine));
class DeathAI {
targetState = "Dead";
condition = QUOTE(!isPlayer _this && {GVAR(unconsciousConditionAI)});
};
2016-12-05 20:34:20 +00:00
class WakeUp {
2016-06-30 21:43:25 +00:00
targetState = "Injured";
2018-05-08 09:16:12 +00:00
condition = QUOTE(_this call EFUNC(medical_status,hasStableVitals));
2016-12-05 20:34:20 +00:00
events[] = {QGVAR(WakeUp)};
onTransition = QUOTE([ARR_2(_this,(false))] call FUNC(setUnconsciousStatemachine));
2016-06-30 21:43:25 +00:00
};
class FatalTransitions {
targetState = "CardiacArrest";
2016-12-05 20:34:20 +00:00
events[] = {QGVAR(FatalVitals)};
2016-06-30 21:43:25 +00:00
};
class FatalInjury {
targetState = "FatalInjury";
2016-12-05 20:34:20 +00:00
events[] = {QGVAR(FatalInjury)};
2016-06-30 21:43:25 +00:00
};
};
class FatalInjury {
// Transition state for handling instant death
2016-11-07 22:46:10 +00:00
// This state raises the next transition in the same frame
onStateEntered = QFUNC(enteredStateFatalInjury);
class DeathAI {
events[] = {QGVAR(FatalInjuryInstantTransition)};
targetState = "Dead";
condition = QUOTE(!isPlayer _this && {GVAR(fatalInjuryConditionAI)});
};
class SecondChance {
2016-11-07 22:46:10 +00:00
events[] = {QGVAR(FatalInjuryInstantTransition)};
targetState = "CardiacArrest";
condition = QUOTE(GVAR(fatalInjuryCondition) > 0);
onTransition = QFUNC(transitionSecondChance);
2016-06-30 21:43:25 +00:00
};
class Death {
2016-11-07 22:46:10 +00:00
events[] = {QGVAR(FatalInjuryInstantTransition)};
2016-06-30 21:43:25 +00:00
targetState = "Dead";
condition = "true";
2016-06-30 21:43:25 +00:00
};
};
class CardiacArrest {
onStateEntered = QFUNC(enteredStateCardiacArrest);
onStateLeaving = QFUNC(leftStateCardiacArrest);
2017-06-18 10:43:39 +00:00
class DeathAI {
targetState = "Dead";
condition = QUOTE(!isPlayer _this && {GVAR(fatalInjuryConditionAI)});
};
2016-12-05 20:34:20 +00:00
class Timeout {
2016-06-30 21:43:25 +00:00
targetState = "Dead";
condition = QEFUNC(medical,conditionCardiacArrestTimer);
2016-06-30 21:43:25 +00:00
};
2016-12-05 20:34:20 +00:00
class Reanimation {
targetState = "Unconscious";
events[] = {QGVAR(CPRSucceeded)};
};
class Execution {
targetState = "Dead";
condition = QEFUNC(medical,conditionExecutionDeath);
2016-12-05 20:34:20 +00:00
events[] = {QGVAR(FatalInjury)};
};
};
class Dead {
onStateEntered = "_this setDamage 1"; // killing a unit also exits the state machine for this unit
2016-06-30 21:43:25 +00:00
};
};