DIFF

class HFSMBase<Class FSMStateBase, Class FSMEventBase, Class FSMActionBase, Class FSMGuardBase>Source

Derived classes

base class for hierarchic finite state machine

stores current state (m_State) and transition table with possible transitions from each state to another state via event

each state can have nested state machine, thus creating hierarchy

Constructors 1

void HFSMBase(FSMStateBase ownerState = NULL)
References m_OwnerState

Members 5

protected FSMStateBase m_OwnerState

state that owns this fsm (or null if root)

Referenced by GetOwnerState(), and HFSMBase()
protected ref FSMStateBase m_InitialState

configurable initial state of the machine

Referenced by SetInitialState(), and Start()
protected ref array<ref FSMTransition<FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase>> m_Transitions = new array<ref FSMTransition<FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase>>

fsm transition table

protected bool m_HasCompletions = false
Referenced by AddTransition(), ProcessEvent(), Start()
Show 1 more, WeaponFSM.ProcessEvent()

Methods 22

void SetCurrentState(FSMStateBase state)

Returns: returns currently active state within this machine (i.e. not hierarchic state)

References m_State
FSMStateBase GetOwnerState()

Returns: returns state that is owner of this fsm submachine. returns null if this is a root machine.

References m_OwnerState
bool GetHierarchyPath(FSMStateBase state, out array<FSMStateBase> path)

returns hierarchic state (path to root) of a state

in state
state the path is starting
out path
current hierarchic state

Returns: true if current state returned in path argument, false otherwise

References array.Count(), GetParentState(), and array.Insert()
void SetInitialState(FSMStateBase initial_state)
in initial_state
state the machine will be entered to after ::Start()
in initial_event
event that will be used to start the machine
References m_InitialState
Referenced by Bot.InitFSM(), Bot_TestSpawnDeadSelectBury.Bot_TestSpawnDeadSelectBury(), Bot_TestSpawnOpen.Bot_TestSpawnOpen()
Show 38 more, BotHunt.BotHunt(), BotTestAttachAndDropCycle.BotTestAttachAndDropCycle(), BotTestItemMoveBackAndForth.BotTestItemMoveBackAndForth(), BotTestSpamUserActions.BotTestSpamUserActions(), ChamberMultiBullet.ChamberMultiBullet(), HandAnimatedForceSwapping.HandAnimatedForceSwapping(), HandAnimatedForceSwapping_Inst.HandAnimatedForceSwapping_Inst(), HandAnimatedMovingToAtt.HandAnimatedMovingToAtt(), HandAnimatedSwapping.HandAnimatedSwapping(), HandAnimatedTakingFromAtt.HandAnimatedTakingFromAtt(), HandReplacingItemElsewhereWithNewInHands.HandReplacingItemElsewhereWithNewInHands(), HandReplacingItemInHands.HandReplacingItemInHands(), HumanInventoryWithFSM.Init(), LoopedChambering.LoopedChambering(), LoopedChamberingCombineChamberInternalMagazine.LoopedChamberingCombineChamberInternalMagazine(), LoopedChamberingEjectLast.LoopedChamberingEjectLast(), RifleChambering.RifleChambering(), RifleEjectCasing.RifleEjectCasing(), RifleReChambering.RifleReChambering(), Weapon_Base.SetInitialState(), WeaponAttachMagazine.WeaponAttachMagazine(), WeaponAttachMagazineOpenBoltCharged.WeaponAttachMagazineOpenBoltCharged(), WeaponChambering.WeaponChambering(), WeaponCharging.WeaponCharging(), WeaponChargingInnerMag.WeaponChargingInnerMag(), WeaponChargingMultiple.WeaponChargingMultiple(), WeaponChargingStretch.WeaponChargingStretch(), WeaponDetachingMag.WeaponDetachingMag(), WeaponDetachingMagOpenBolt.WeaponDetachingMagOpenBolt(), WeaponEjectBullet.WeaponEjectBullet(), WeaponFireAndChamberNext.WeaponFireAndChamberNext(), WeaponFireAndChamberNextFromInnerMag.WeaponFireAndChamberNextFromInnerMag(), WeaponFireLast.WeaponFireLast(), WeaponMagnumChambering.WeaponMagnumChambering(), WeaponRechamber.WeaponRechamber(), WeaponReplacingMagAndChamberNext.WeaponReplacingMagAndChamberNext(), WeaponReplacingMagAndChamberNextOpenBoltCharged.WeaponReplacingMagAndChamberNextOpenBoltCharged(), and WeaponUnjamming.WeaponUnjamming()
void Terminate(FSMEventBase terminal_event = NULL)

terminates the state machine

References fsmDebugPrint(), LogManager.IsInventoryHFSMLogEnable(), IsRunning()
Show 4 more, OnExit(), ToString(), Class.ToString(), and m_State
void Abort(FSMEventBase abort_event = NULL)
References fsmDebugPrint(), LogManager.IsInventoryHFSMLogEnable(), IsRunning()
Show 4 more, OnAbort(), ToString(), Class.ToString(), and m_State
void Update(float dt)

if machine running, call OnUpdate() on current state

References IsRunning(), OnUpdate(), and m_State
protected ProcessEventResult ProcessAbortTransition(FSMTransition<FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase> t, FSMEventBase e)
References Action(), fsmDebugPrint(), GetParentState()
Show 14 more, GetParentState(), LogManager.IsInventoryHFSMLogEnable(), OnAbort(), OnEntry(), ToString(), ToString(), ToString(), ToString(), ToString(), FSMTransition.m_action, FSMTransition.m_dstState, FSMTransition.m_guard, FSMTransition.m_srcState, and m_State
Referenced by ProcessAbortEvent()
FSMStateBase FindAbortDestinationState(FSMEventBase e)

i

in e
event that will be used to find suitable transition from current state

Returns: FSM_OK if transition found and allowed by guard (if any) FSM_NO_TRANSITION if no unguarded transition found in submachine or local machine FSM_TERMINATED state machine has terminated FSM_ABORTED state machine has aborted

FSMStateBase ProcessAbortEvent(FSMEventBase e, out ProcessEventResult result)

instructs the hierarchical state machine to process the event e

in e
event that will be used to find suitable transition from current state

Returns: FSM_OK if transition found and allowed by guard (if any) FSM_NO_TRANSITION if no unguarded transition found in submachine or local machine FSM_TERMINATED state machine has terminated FSM_ABORTED state machine has aborted

References FindFirstUnguardedTransition(), fsmDebugPrint(), array.Get()
Show 16 more, GetFSM(), GetOwnerState(), GetParentState(), HasFSM(), LogManager.IsInventoryHFSMLogEnable(), OnAbort(), OnEntry(), ProcessAbortEvent(), ProcessAbortTransition(), ToString(), ToString(), ToString(), Class.Type(), Class.Type(), m_State, and m_Transitions
ProcessEventResult ProcessEvent(FSMEventBase e)

instructs the hierarchical state machine to process the event e

in e
event that will be used to find suitable transition from current state

Returns: FSM_OK if transition found and allowed by guard (if any) FSM_NO_TRANSITION if no unguarded transition found in submachine or local machine FSM_TERMINATED state machine has terminated

References DumpToString(), Error(), FindFirstUnguardedTransition()
Show 20 more, fsmDebugPrint(), fsmDebugSpam(), array.Get(), GetOwnerState(), GetParentState(), GetParentState(), HasFSM(), LogManager.IsInventoryHFSMLogEnable(), LogManager.IsWeaponLogEnable(), LocalTransition(), ProcessCompletionTransitions(), ProcessEvent(), ToString(), ToString(), ToString(), Class.Type(), Class.Type(), m_HasCompletions, m_State, and m_Transitions
protected int FindFirstUnguardedTransition(FSMEventBase e)
References array.Count(), array.Get(), GuardCondition()
Show 4 more, Class.Type(), Class.Type(), m_State, and m_Transitions
FSMStateBase FindTransitionState(FSMStateBase s, FSMEventBase e)
References array.Count(), array.Get(), Class.Type()
Show 2 more, Class.Type(), and m_Transitions
FSMStateBase FindGuardedTransitionState(FSMStateBase s, FSMEventBase e)
References array.Count(), array.Get(), GuardCondition()
Show 3 more, Class.Type(), Class.Type(), and m_Transitions
protected int FindFirstCompletionTransition()
References array.Count(), array.Get(), GuardCondition()
Show 5 more, IsRunning(), Class.Type(), Class.Type(), m_State, and m_Transitions
protected ProcessEventResult ProcessLocalTransition(FSMTransition<FSMStateBase, FSMEventBase, FSMActionBase, FSMGuardBase> t, FSMEventBase e)

instructs the state machine to process the event locally - no hierarchy is crossed

in t
the transition in m_Transitions
in e
event that will be used to process transition from current state

Returns: FSM_OK or FSM_TERMINATED

References Action(), fsmDebugPrint(), GetOwnerState()
Show 15 more, LogManager.IsInventoryHFSMLogEnable(), OnEntry(), OnExit(), OnStateChanged(), OnSubMachineChanged(), ToString(), ToString(), ToString(), ToString(), ToString(), FSMTransition.m_action, FSMTransition.m_dstState, FSMTransition.m_guard, FSMTransition.m_srcState, and m_State
Referenced by LocalTransition()
protected ProcessEventResult LocalTransition(int i, FSMEventBase e)

instructs the state machine to process the event e

in i
index of the transition in m_Transitions
in e
event that will be used to process transition from current state

Returns: FSM_OK or FSM_TERMINATED

protected ProcessEventResult ProcessCompletionTransitions()
References Error(), FindFirstCompletionTransition(), array.Get()
Show 5 more, GetOwnerState(), GetParentState(), GetParentState(), LocalTransition(), and m_Transitions