13 WeaponStateBase m_parentState;
15 int m_InternalID = -1;
17 void WeaponStateBase (Weapon_Base w = NULL, WeaponStateBase parent = NULL) { m_weapon = w; m_parentState = parent; }
22 void SetParentState (WeaponStateBase parent) { m_parentState = parent; }
26 WeaponStateBase GetParentState () {
return m_parentState; }
28 bool HasFSM () {
return m_fsm != NULL; }
29 WeaponFSM GetFSM () {
return m_fsm; }
31 void SetInternalStateID (
int i) { m_InternalID = i; }
32 int GetInternalStateID () {
return m_InternalID; }
40 if (LogManager.IsWeaponLogEnable()) {
wpnDebugSpam(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" WeaponStateBase::SaveCurrentFSMState - idle state, skipping other substates"); }
41 return m_fsm.SaveCurrentFSMState(ctx);
46 if (LogManager.IsWeaponLogEnable()) {
wpnDebugSpam(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" WeaponStateBase::SaveCurrentFSMState - NOT idle state, saving full submachine state"); }
47 return m_fsm.SaveCurrentUnstableFSMState(ctx);
60 if (LogManager.IsWeaponLogEnable()) {
wpnDebugSpam(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" WeaponStateBase::LoadCurrentFSMState - idle state, skipping other substates"); }
61 if (m_fsm.LoadCurrentFSMState(ctx, version))
64 Error(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" WeaponStateBase::LoadCurrentFSMState - Cannot load stable state for weapon=" +
this);
69 if (LogManager.IsWeaponLogEnable()) {
wpnDebugSpam(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" WeaponStateBase::LoadCurrentFSMState - NOT idle state, loading full submachine state"); }
70 if (m_fsm.LoadCurrentUnstableFSMState(ctx, version))
73 Error(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" WeaponStateBase::LoadCurrentFSMState - Cannot load unstable state for weapon=" +
this);
83 return m_fsm.ProcessEvent(e);
92 m_fsm.AddTransition(t);
94 Error(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" adding transition to state without FSM. Configure FSM first.");
105 if (HasFSM() && !m_fsm.IsRunning())
107 if (LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" { " +
this.Type().ToString() +
" Has Sub-FSM! Starting submachine..."); }
111 if (LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" { " +
this.Type().ToString()); }
121 if (HasFSM() && m_fsm.IsRunning())
122 m_fsm.GetCurrentState().OnUpdate(dt);
131 if (HasFSM() && m_fsm.IsRunning())
133 if (LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" OnAbort " +
this.Type().ToString() +
" Has Sub-FSM! Aborting submachine..."); }
136 if (LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" } ABORTED " +
this.Type().ToString()); }
145 if (LogManager.IsWeaponLogEnable()) {
wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(m_weapon) +
" } " +
this.Type().ToString()); }
152 bool IsWaitingForActionFinish () {
return HasFSM() && m_fsm.IsRunning() && m_fsm.GetCurrentState().IsWaitingForActionFinish(); }
158 bool IsIdle () {
return false; }
170 void OnSubMachineChanged (WeaponStateBase src, WeaponStateBase dst) { }
177 void OnStateChanged (WeaponStateBase src, WeaponStateBase dst) { }
179 float GetCoolDown() {
return 0; }
void wpnDebugSpam(string s)
void wpnDebugPrint(string s)
represent weapon state base
Serializer ParamsReadContext
Serializer ParamsWriteContext
void Error(string err)
Messagebox with error message.
HandStateEquipped OnEntry
override bool IsBoltOpen()
enum FSMTransition WeaponTransition
enum FSMTransition WeaponEventBase
class WeaponChambering extends WeaponStateBase IsWaitingForActionFinish
class WeaponChambering_Chamber_OnEntry extends WeaponChambering_Base OnExit