2016-06-30 21:43:25 +00:00
|
|
|
class ACE_Medical_StateMachine {
|
|
|
|
class Default {
|
2016-07-07 09:46:55 +00:00
|
|
|
onState = QUOTE(DFUNC(handleStateDefault));
|
2016-06-30 21:43:25 +00:00
|
|
|
class Injury {
|
|
|
|
targetState = "Injured";
|
2016-11-07 21:21:07 +00:00
|
|
|
events[] = {QGVAR(TakenInjury)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
class CriticalInjuryOrVitals {
|
|
|
|
targetState = "Unconscious";
|
2016-11-07 21:21:07 +00:00
|
|
|
events[] = {QGVAR(InjuryCritical), QGVAR(CriticalVitals)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
class FatalInjury {
|
|
|
|
targetState = "FatalInjury";
|
|
|
|
events[] = {QGVAR(InjuryFatal)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
class Injured {
|
2016-07-07 09:46:55 +00:00
|
|
|
onState = QUOTE(DFUNC(handleStateInjured));
|
2016-06-30 21:43:25 +00:00
|
|
|
class FullHeal {
|
|
|
|
targetState = "Default";
|
2016-11-07 21:21:07 +00:00
|
|
|
events[] = {QGVAR(FullHeal)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
class LastWoundTreated {
|
|
|
|
targetState = "Default";
|
2016-11-07 21:21:07 +00:00
|
|
|
events[] = {QGVAR(LastWoundTreated)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
class CriticalInjuryOrVitals {
|
|
|
|
targetState = "Unconscious";
|
2016-11-07 21:21:07 +00:00
|
|
|
events[] = {QGVAR(InjuryCritical), QGVAR(CriticalVitals)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
class FatalVitals {
|
|
|
|
targetState = "CardiacArrest";
|
|
|
|
events[] = {QGVAR(FatalVitals)};
|
|
|
|
};
|
|
|
|
class FatalInjury {
|
|
|
|
targetState = "FatalInjury";
|
|
|
|
events[] = {QGVAR(InjuryFatal)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
class Unconscious {
|
2016-07-07 09:46:55 +00:00
|
|
|
onState = QUOTE(DFUNC(handleStateUnconscious));
|
2016-07-07 10:57:21 +00:00
|
|
|
onStateEntered = QUOTE(DFUNC(enteredUnconsciousState));
|
2016-11-07 21:21:07 +00:00
|
|
|
onStateLeaving = "_this setVariable ['ACE_isUnconscious', false, true];";
|
2016-06-30 21:43:25 +00:00
|
|
|
class WakeUpFromKnockDown {
|
|
|
|
targetState = "Injured";
|
2016-11-07 21:21:07 +00:00
|
|
|
condition = QUOTE(_this call FUNC(hasStableVitals));
|
|
|
|
events[] = {QGVAR(MinUnconsciousTimer)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
class WakeUpStable {
|
|
|
|
targetState = "Injured";
|
|
|
|
condition = "unitUnconsciousTimer >= MinUnconsciousTimer";
|
2016-11-07 21:21:07 +00:00
|
|
|
events[] = {QGVAR(VitalsWentStable)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
|
|
|
class FatalTransitions {
|
2016-11-07 21:21:07 +00:00
|
|
|
targetState = "CardiacArrest";
|
|
|
|
events[] = {QGVAR(FatalVitals), QGVAR(UnconsciousTimerRanOut)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
class FatalInjury {
|
|
|
|
targetState = "FatalInjury";
|
|
|
|
events[] = {QGVAR(InjuryFatal)};
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-07 21:21:07 +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
|
2016-11-07 21:21:07 +00:00
|
|
|
onStateEntered = QUOTE(DFUNC(enteredStateFatalInjury));
|
2016-11-09 18:01:55 +00:00
|
|
|
class SecondChance {
|
2016-11-07 22:46:10 +00:00
|
|
|
events[] = {QGVAR(FatalInjuryInstantTransition)};
|
2016-11-07 21:21:07 +00:00
|
|
|
targetState = "CardiacArrest";
|
2016-11-13 21:27:40 +00:00
|
|
|
condition = QUOTE(GVAR(fatalInjuryCondition) > 0);
|
2016-11-09 18:01:55 +00:00
|
|
|
onTransition = QUOTE(DFUNC(transitionSecondChance));
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-09 18:01:55 +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";
|
2016-11-07 21:21:07 +00:00
|
|
|
condition = "true";
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
};
|
|
|
|
class CardiacArrest {
|
|
|
|
onStateEntered = QUOTE(DFUNC(enteredStateCardiacArrest));
|
|
|
|
onStateLeaving = '_this setVariable [QGVAR(cardiacArrestStart), nil]';
|
2016-11-09 18:01:55 +00:00
|
|
|
class TimerRanOut {
|
2016-06-30 21:43:25 +00:00
|
|
|
targetState = "Dead";
|
2016-11-09 18:01:55 +00:00
|
|
|
condition = QUOTE(DFUNC(conditionCardiacArrestTimer));
|
2016-06-30 21:43:25 +00:00
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
class Reanimated {
|
|
|
|
targetState = "Unconscious";
|
|
|
|
events[] = {QGVAR(CPRSucceeded)};
|
|
|
|
};
|
2016-11-08 18:37:56 +00:00
|
|
|
class Execution {
|
|
|
|
targetState = "Dead";
|
|
|
|
condition = QUOTE(DFUNC(conditionExecutionDeath));
|
|
|
|
events[] = {QGVAR(InjuryFatal)};
|
|
|
|
};
|
2016-11-07 21:21:07 +00:00
|
|
|
};
|
|
|
|
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
|
|
|
};
|
|
|
|
};
|