ACE3/addons/medical/ACE_Medical_StateMachine.hpp

90 lines
3.1 KiB
C++
Raw Normal View History

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
onStateEntered = "";
onStateLeaving = "";
class Injury {
targetState = "Injured";
events[] = {"TakenInjury"};
2016-06-30 21:43:25 +00:00
};
class CriticalInjuryOrVitals {
targetState = "Unconscious";
events[] = {"InjuryCritical", "CriticalVitals"};
2016-06-30 21:43:25 +00:00
};
class FatalInjuryOrVitals {
targetState = "Dead";
events[] = {"FatalVitals", "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
onStateEntered = "";
onStateLeaving = "";
class FullHeal {
targetState = "Default";
events[] = {"FullHeal"};
2016-06-30 21:43:25 +00:00
};
class LastWoundTreated {
targetState = "Default";
events[] = {"LastWoundTreated"};
2016-06-30 21:43:25 +00:00
};
class CriticalInjuryOrVitals {
targetState = "Unconscious";
events[] = {"InjuryCritical", "CriticalVitals"};
2016-06-30 21:43:25 +00:00
};
class FatalInjuryOrVitals {
targetState = "Dead";
events[] = {"FatalVitals", "InjuryFatal"};
2016-06-30 21:43:25 +00:00
};
};
class Unconscious {
2016-07-07 09:46:55 +00:00
onState = QUOTE(DFUNC(handleStateUnconscious));
2016-06-30 21:43:25 +00:00
onStateEntered = QUOTE(DFUNC(enteredUnconscious)); // set unconscious animation & state
onStateLeaving = QUOTE(DFUNC(leavingUnconscious)); // leave unconscious animation & state
class WakeUpFromKnockDown {
targetState = "Injured";
condition = QUOTE(_unit call FUNC(hasStableVitals));
events[] = {"MinUnconsciousTimer"};
2016-06-30 21:43:25 +00:00
};
class WakeUpStable {
targetState = "Injured";
condition = "unitUnconsciousTimer >= MinUnconsciousTimer";
events[] = {"VitalsWentStable"};
2016-06-30 21:43:25 +00:00
};
class FatalTransitions {
targetState = "Dead";
events[] = {"InjuryFatal", "FatalVitals", "UnconsciousTimerRanOut"};
2016-06-30 21:43:25 +00:00
};
};
class Dead {
onStateEntered = "(_this select 0) setDamage 1"; // killing a unit also exits the state machine for this unit
};
class Revive {
2016-07-07 09:46:55 +00:00
onState = QUOTE(DFUNC(handleStateRevive));
2016-06-30 21:43:25 +00:00
onStateEntered = QUOTE(DFUNC(enteredRevive)); // set unconscious animation & state
onStateLeaving = QUOTE(DFUNC(leavingRevive)); // leave unconscious animation & state
class FullHeal {
targetState = "Default";
events[] = {"fullyHealed"};
2016-06-30 21:43:25 +00:00
onTransition = "";
};
class Revived {
targetState = "Injured";
events[] = {"Revived"};
2016-06-30 21:43:25 +00:00
onTransition = "";
};
class TimerRanOut {
targetState = "Dead";
condition = "timerValue >= maxReviveTime";
events[] = {"ReviveTimer"};
2016-06-30 21:43:25 +00:00
onTransition = "";
};
class FatalTransitions {
targetState = "Dead";
condition = "killOnFatalDamageInRevive && inReviveState >= 10";
events[] = {"FatalInjury"};
2016-06-30 21:43:25 +00:00
};
};
};