Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
handstatebase.c
Go to the documentation of this file.
1
7{
8 Man m_Player;
11 void HandStateBase (Man player = NULL, HandStateBase parent = NULL) { m_Player = player; m_parentState = parent; }
12
16 void SetParentState (HandStateBase parent) { m_parentState = parent; }
21
22 bool HasFSM () { return m_FSM != NULL; }
23 HandFSM GetFSM () { return m_FSM; }
24
26 {
27 if (HasFSM())
28 return m_FSM.ProcessEvent(e);
29 return false;
30 }
31
36 {
37 if (HasFSM())
38 m_FSM.AddTransition(t);
39 else
40 Error("[hndfsm] adding transition to state without FSM. Configure FSM first.");
41 }
42
43
50 {
51 if (HasFSM() && !m_FSM.IsRunning())
52 {
53 if (e)
54 {
55 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] { " + Object.GetDebugName(e.m_Player) + " STS = " + e.m_Player.GetSimulationTimeStamp() + " " + this.Type().ToString() + " Has Sub-FSM! Starting submachine... OnEntry");
56 }
57 else
58 {
59 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] { " + this.Type().ToString() + " Has Sub-FSM! Starting submachine... OnEntry");
60 }
61 m_FSM.Start(e);
62 }
63 else
64 {
65 if (e)
66 {
67 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] { " + Object.GetDebugName(e.m_Player) + " STS = " + e.m_Player.GetSimulationTimeStamp() + " " + this.Type().ToString() + " OnEntry");
68 }
69 else
70 {
71 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] { " + this.Type().ToString() + " OnEntry");
72 }
73 }
74 }
75
81 void OnUpdate (float dt)
82 {
83 if (HasFSM() && m_FSM.IsRunning())
84 m_FSM.GetCurrentState().OnUpdate(dt);
85 }
86
92 {
93 if (HasFSM() && m_FSM.IsRunning())
94 {
95 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] OnAbort " + this.Type().ToString() + " Has Sub-FSM! Aborting submachine... OnAbort");
96 m_FSM.Abort(e);
97 }
98 //Debug.InventoryHFSMLog("ABORTED " + e.m_Player.GetSimulationTimeStamp(), ""/*typename.EnumToString(HandEventID, GetEventID()) */, "n/a", "OnAbort", m_Player.ToString() );
99 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] } " + Object.GetDebugName(e.m_Player) + " STS = " + e.m_Player.GetSimulationTimeStamp() + " ABORTED " + this.Type().ToString() + " OnAbort");
100 }
101
107 {
108 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[hndfsm] } " + Object.GetDebugName(e.m_Player) + " STS = " + e.m_Player.GetSimulationTimeStamp() + " " + this.Type().ToString() + " OnExit");
109 }
110
115 bool IsWaitingForActionFinish () { return HasFSM() && m_FSM.IsRunning() && m_FSM.GetCurrentState().IsWaitingForActionFinish(); }
116
121 bool IsIdle () { return false; }
122
129
136 {
137 m_Player.GetHumanInventory().OnHandsStateChanged(src, dst);
138 }
139};
140
141
142
Abstracted event, not to be used, only inherited.
Hand finite state machine.
represent hand state base
void AddTransition(HandTransition t)
void OnSubMachineChanged(HandStateBase src, HandStateBase dst)
ref HandFSM m_FSM
hierarchical parent state of this state (or null)
void OnEntry(HandEventBase e)
void HandStateBase(Man player=NULL, HandStateBase parent=NULL)
nested state machine (or null)
void SetParentState(HandStateBase parent)
void OnStateChanged(HandStateBase src, HandStateBase dst)
HandFSM GetFSM()
bool ProcessEvent(HandEventBase e)
void OnExit(HandEventBase e)
bool IsWaitingForActionFinish()
void OnUpdate(float dt)
void OnAbort(HandEventBase e)
HandStateBase GetParentState()
HandStateBase m_parentState
entity that this state relates to
static bool IsInventoryHFSMLogEnable()
Definition debug.c:766
proto string ToString()
void Error(string err)
Messagebox with error message.
Definition endebug.c:90
void hndDebugPrint(string s)
Definition handfsm.c:1
FSMTransition< HandStateBase, HandEventBase, HandActionBase, HandGuardBase > HandTransition
Definition handfsm.c:28
string Type