ACE3/addons/medical_statemachine/Statemachine.hpp
SilentSpike 4466f9e785
Strip medical component (#6442)
* Move litter to `treatment`
* Move eden object attributes to `treatment`
* Move treatment items to `treatment`
* Move bodybag handling to `treatment`
* Move state conditions to `statemachine`
* Move radio addon handling to `feedback`
* Move medical macros to `engine`
* Move medical extension to `damage`
* Fix texture and material paths after move
* Remove duplicate medical menu config
* Remove old faction class
* Remove a bunch of old code
2018-07-18 19:13:25 +01:00

115 lines
4.3 KiB
C++

// Manual transitions applied to this statemachine
// - medical_fnc_handleRespawn:18
class ACE_Medical_StateMachine {
list = "allUnits select {local _x}";
skipNull = 1;
class Default {
onState = QFUNC(handleStateDefault);
class Injury {
targetState = "Injured";
events[] = {QEGVAR(medical,Injury)};
};
class CriticalInjuryOrVitals {
targetState = "Unconscious";
events[] = {QEGVAR(medical,CriticalInjury), QEGVAR(medical,CriticalVitals), QEGVAR(medical,knockOut)};
};
class FatalVitals {
targetState = "CardiacArrest";
events[] = {QEGVAR(medical,FatalVitals)};
};
class FatalInjury {
targetState = "FatalInjury";
events[] = {QEGVAR(medical,FatalInjury)};
};
};
class Injured {
onState = QFUNC(handleStateInjured);
class FullHeal {
targetState = "Default";
events[] = {QEGVAR(medical,FullHeal)};
};
class CriticalInjuryOrVitals {
targetState = "Unconscious";
events[] = {QEGVAR(medical,CriticalInjury), QEGVAR(medical,CriticalVitals), QEGVAR(medical,knockOut)};
};
class FatalVitals {
targetState = "CardiacArrest";
events[] = {QEGVAR(medical,FatalVitals)};
};
class FatalInjury {
targetState = "FatalInjury";
events[] = {QEGVAR(medical,FatalInjury)};
};
};
class Unconscious {
onState = QFUNC(handleStateUnconscious);
onStateEntered = QUOTE([ARR_2(_this,(true))] call EFUNC(medical_status,setUnconsciousStatemachine));
class DeathAI {
targetState = "Dead";
condition = QUOTE(!isPlayer _this && {EGVAR(medical,unconsciousConditionAI)});
};
class WakeUp {
targetState = "Injured";
condition = QEFUNC(medical_status,hasStableVitals);
events[] = {QEGVAR(medical,WakeUp)};
onTransition = QUOTE([ARR_2(_this,(false))] call EFUNC(medical_status,setUnconsciousStatemachine));
};
class FatalTransitions {
targetState = "CardiacArrest";
events[] = {QEGVAR(medical,FatalVitals)};
};
class FatalInjury {
targetState = "FatalInjury";
events[] = {QEGVAR(medical,FatalInjury)};
};
};
class FatalInjury {
// Transition state for handling instant death
// This state raises the next transition in the same frame
onStateEntered = QFUNC(enteredStateFatalInjury);
class DeathAI {
events[] = {QEGVAR(medical,FatalInjuryInstantTransition)};
targetState = "Dead";
condition = QUOTE(!isPlayer _this && {EGVAR(medical,fatalInjuryConditionAI)});
};
class SecondChance {
events[] = {QEGVAR(medical,FatalInjuryInstantTransition)};
targetState = "CardiacArrest";
condition = QUOTE(EGVAR(medical,fatalInjuryCondition) > 0);
onTransition = QFUNC(transitionSecondChance);
};
class Death {
events[] = {QEGVAR(medical,FatalInjuryInstantTransition)};
targetState = "Dead";
condition = "true";
};
};
class CardiacArrest {
onStateEntered = QFUNC(enteredStateCardiacArrest);
onStateLeaving = QFUNC(leftStateCardiacArrest);
class DeathAI {
targetState = "Dead";
condition = QUOTE(!isPlayer _this && {EGVAR(medical,fatalInjuryConditionAI)});
};
class Timeout {
targetState = "Dead";
condition = QFUNC(conditionCardiacArrestTimer);
};
class Reanimation {
targetState = "Unconscious";
events[] = {QEGVAR(medical,CPRSucceeded)};
};
class Execution {
targetState = "Dead";
condition = QFUNC(conditionExecutionDeath);
events[] = {QEGVAR(medical,FatalInjury)};
};
};
class Dead {
// TODO: this needs to be handled by a function instead of inline scripts
// Probably also needs additional logic to deal with edge cases
onStateEntered = "_this setDamage 1"; // killing a unit also exits the state machine for this unit
};
};