Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
botstates.c
Go to the documentation of this file.
1
10class BotStateBase
11{
16
17 void BotStateBase (Bot bot = NULL, BotStateBase parent = NULL) { m_Bot = bot; m_Owner = bot.m_Owner; m_ParentState = parent; }
18
20
24 void SetParentState (BotStateBase parent) { m_ParentState = parent; }
29
30 bool HasFSM () { return m_FSM != NULL; }
31 BotFSM GetFSM () { return m_FSM; }
32
34 {
35 if (HasFSM())
36 return m_FSM.ProcessEvent(e);
37 return false;
38 }
39
44 {
45 if (HasFSM())
46 m_FSM.AddTransition(t);
47 else
48 Error("[botfsm] adding transition to state without FSM. Configure FSM first.");
49 }
50
51
58 {
59 if (HasFSM() && !m_FSM.IsRunning())
60 {
61 botDebugPrint("[botfsm] { " + this.Type().ToString() + " Has Sub-FSM! Starting submachine...");
62 m_FSM.Start(e);
63 }
64 else
65 botDebugPrint("[botfsm] { " + this.Type().ToString());
66 }
67
73 void OnUpdate (float dt)
74 {
75 if (HasFSM() && m_FSM.IsRunning())
76 m_FSM.GetCurrentState().OnUpdate(dt);
77 }
78
84 {
85 if (HasFSM() && m_FSM.IsRunning())
86 {
87 botDebugPrint("[botfsm] OnAbort " + this.Type().ToString() + " Has Sub-FSM! Aborting submachine...");
88 m_FSM.Abort(e);
89 }
90 botDebugPrint("[botfsm] } ABORTED " + this.Type().ToString());
91 }
92
98 {
99 botDebugPrint("[botfsm] } " + this.Type().ToString());
100 }
101
106 bool IsWaitingForActionFinish () { return HasFSM() && m_FSM.IsRunning() && m_FSM.GetCurrentState().IsWaitingForActionFinish(); }
107
112 bool IsIdle () { return false; }
113
120
127};
128
130{
131 void BotStateIdle (Bot bot = NULL, BotStateBase parent = NULL) { m_Bot = bot; m_Owner = m_Bot.m_Owner; m_ParentState = parent; }
132
133 override bool IsIdle () { return true; }
134};
void botDebugPrint(string s)
Definition bot.c:122
represents event that triggers transition from state to state
Definition botevents.c:5
Bot Finite State Machine (Hierarchical).
Definition bot.c:19
represent weapon state base
Definition bot_hunt.c:16
bool HasFSM()
Definition botstates.c:30
void OnStateChanged(BotStateBase src, BotStateBase dst)
Definition botstates.c:126
ref BotFSM m_FSM
hierarchical parent state of this state (or null)
Definition botstates.c:15
bool IsIdle()
idle state does not expect any animation events
Definition botstates.c:112
void AddTransition(FSMTransition< BotStateBase, BotEventBase, BotActionBase, BotGuardBase > t)
Definition botstates.c:43
bool ProcessEvent(BotEventBase e)
Definition botstates.c:33
void BotStateBase(Bot bot=NULL, BotStateBase parent=NULL)
nested state machine (or null)
Definition botstates.c:17
void OnExit(BotEventBase e)
Definition botstates.c:97
PlayerBase GetPlayerOwner()
Definition botstates.c:19
void OnEntry(BotEventBase e)
Definition botstates.c:57
BotFSM GetFSM()
Definition botstates.c:31
PlayerBase m_Owner
Definition botstates.c:12
void OnSubMachineChanged(BotStateBase src, BotStateBase dst)
Definition botstates.c:119
bool IsWaitingForActionFinish()
waiting for active animation action/actionType finish
Definition botstates.c:106
void OnUpdate(float dt)
Definition botstates.c:73
BotStateBase GetParentState()
Definition botstates.c:28
Bot m_Bot
man that this state belongs to
Definition botstates.c:13
void OnAbort(BotEventBase e)
Definition botstates.c:83
BotStateBase m_ParentState
bot that this state belongs to
Definition botstates.c:14
void SetParentState(BotStateBase parent)
Definition botstates.c:24
void BotStateIdle(Bot bot=NULL, BotStateBase parent=NULL)
Definition botstates.c:131
override bool IsIdle()
Definition botstates.c:133
represents transition src -— event[guard]/action -—|> dst
proto string ToString()
void Error(string err)
Messagebox with error message.
Definition endebug.c:90
string Type