DIFF

class WeaponStateBaseSource

Derived classes
View all 178 descendants

represent weapon state base

Class comes with entry/update/abort/exit hooks that can be overriden in custom states

Class is ready for hierarchic composition, i.e. this state having a sub-machine running under hood. If no m_fsm member is configured, class acts as ordinary plain finite machine state.

Constructors 1

void WeaponStateBase(Weapon_Base w = NULL, WeaponStateBase parent = NULL)
References m_parentState, and m_weapon

Members 4

Weapon_Base m_weapon

weapon that this state relates to

WeaponStateBase m_parentState

hierarchical parent state of this state (or null)

ref WeaponFSM m_fsm

nested state machine (or null)

int m_InternalID = -1

internal state id used for load/restore

Methods 20

void SetParentState(WeaponStateBase parent)

allows construction of hierarchical state machine

References m_parentState
WeaponStateBase GetParentState()

Returns: state that owns this sub-state (or null if plain state)

References m_parentState
WeaponFSM GetFSM()
References m_fsm
void SetInternalStateID(int i)
References m_InternalID
bool SaveCurrentFSMState(ParamsWriteContext ctx)
bool ProcessEvent(WeaponEventBase e)
void AddTransition(WeaponTransition t)

adds transition into m_fsm transition table

void OnEntry(WeaponEventBase e)

called upon entry to state @NOTE if state has (non-running) sub-machine, it's started on entry

in e
the event that triggered transition to this state
void OnUpdate(float dt)

ongoing behavior, performed while being in the state

@NOTE: this is supposed to be the Do() operation in UML speak

References HFSMBase.GetCurrentState(), HasFSM(), HFSMBase.IsRunning()
Show 2 more, OnUpdate(), and m_fsm
void OnExit(WeaponEventBase e)

called on exit from state

in e
the event that triggered transition from this state
Referenced by AttachNewMagazine.OnExit(), BulletHide.OnExit(), BulletShow.OnExit()
Show 44 more, BulletShow2.OnExit(), ChamberMultiBullet.OnExit(), DetachOldMagazine.OnExit(), LoopedChambering.OnExit(), LoopedChamberingCombineChamberInternalMagazine.OnExit(), LoopedChamberingEjectLast.OnExit(), MagazineHide.OnExit(), MagazineShow.OnExit(), RemoveNewMagazineFromInventory.OnExit(), RifleChambering.OnExit(), RifleReChambering.OnExit(), SwapOldAndNewMagazine.OnExit(), WeaponChamberFromAttMag.OnExit(), WeaponChamberFromAttMagOnExit.OnExit(), WeaponChamberFromAttMagOpenbolt.OnExit(), WeaponChamberFromInnerMag.OnExit(), WeaponChambering.OnExit(), WeaponChambering_Cartridge.OnExit(), WeaponChambering_Cartridge_ChambToMag.OnExit(), WeaponChambering_InternalMagazine_OnExit.OnExit(), WeaponChambering_MultiMuzzle.OnExit(), WeaponChambering_MultiMuzzleMagnum.OnExit(), WeaponChargingInnerMag.OnExit(), WeaponChargingMultiple.OnExit(), WeaponDetachingMag.OnExit(), WeaponDetachingMag_Store.OnExit(), WeaponDetachingMag_StoreRemoveChamberBullet.OnExit(), WeaponDetachingMagOpenBolt.OnExit(), WeaponEjectAndChamberFromAttMag.OnExit(), WeaponEjectBullet.OnExit(), WeaponEjectBullet_Cartridge.OnExit(), WeaponEjectBulletMultiMuzzle_Cartridge.OnExit(), WeaponEjectCasingAndChamberFromAttMag.OnExit(), WeaponFireAndChamberNext.OnExit(), WeaponFireAndChamberNextFromInnerMag.OnExit(), WeaponFireLast.OnExit(), WeaponMagnumChambering.OnExit(), WeaponRechamber.OnExit(), WeaponReplacingMagAndChamberNext.OnExit(), WeaponReplacingMagAndChamberNextOpenBoltCharged.OnExit(), WeaponStableState.OnExit(), WeaponStartAction.OnExit(), WeaponUnjamming.OnExit(), and WeaponUnjamming_Cartridge.OnExit()
bool IsWaitingForActionFinish()

waiting for active animation action/actionType finish

Returns: true if this state or active substate is waiting for finish signal

References HFSMBase.GetCurrentState(), HasFSM(), HFSMBase.IsRunning()
Show 2 more, IsWaitingForActionFinish(), and m_fsm
bool IsIdle()

idle state does not expect any animation events

Returns: true if this state is idle

bool IsBoltOpen()

Returns: true if weapon bolt is open

void OnSubMachineChanged(WeaponStateBase src, WeaponStateBase dst)

called when sub-machine has changed its state

in src
from state (previous)
in dst
to state (current)
void OnStateChanged(WeaponStateBase src, WeaponStateBase dst)

called on current state when state machine has changed its state

in src
from state (previous)
in dst
to state (current)
float GetCoolDown()