DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
BotStates.c
См. документацию.
1#ifdef ROBOCLIENT
11class BotStateBase
12{
13 PlayerBase m_Owner;
14 Bot m_Bot;
15 BotStateBase m_ParentState;
16 ref BotFSM m_FSM;
17
18 void BotStateBase (Bot bot = NULL, BotStateBase parent = NULL) { m_Bot = bot; m_Owner = bot.m_Owner; m_ParentState = parent; }
19
20 PlayerBase GetPlayerOwner() { return m_Owner; }
21
25 void SetParentState (BotStateBase parent) { m_ParentState = parent; }
29 BotStateBase GetParentState () { return m_ParentState; }
30
31 bool HasFSM () { return m_FSM != NULL; }
32 BotFSM GetFSM () { return m_FSM; }
33
34 bool ProcessEvent (BotEventBase e)
35 {
36 if (HasFSM())
37 return m_FSM.ProcessEvent(e);
38 return false;
39 }
40
45 {
46 if (HasFSM())
47 m_FSM.AddTransition(t);
48 else
49 Error("[botfsm] adding transition to state without FSM. Configure FSM first.");
50 }
51
52
58 void OnEntry (BotEventBase e)
59 {
60 if (HasFSM() && !m_FSM.IsRunning())
61 {
62 botDebugPrint("[botfsm] { " + this.Type().ToString() + " Has Sub-FSM! Starting submachine...");
63 m_FSM.Start(e);
64 }
65 else
66 botDebugPrint("[botfsm] { " + this.Type().ToString());
67 }
68
74 void OnUpdate (float dt)
75 {
76 if (HasFSM() && m_FSM.IsRunning())
77 m_FSM.GetCurrentState().OnUpdate(dt);
78 }
79
84 void OnAbort (BotEventBase e)
85 {
86 if (HasFSM() && m_FSM.IsRunning())
87 {
88 botDebugPrint("[botfsm] OnAbort " + this.Type().ToString() + " Has Sub-FSM! Aborting submachine...");
89 m_FSM.Abort(e);
90 }
91 botDebugPrint("[botfsm] } ABORTED " + this.Type().ToString());
92 }
93
98 void OnExit (BotEventBase e)
99 {
100 botDebugPrint("[botfsm] } " + this.Type().ToString());
101 }
102
107 bool IsWaitingForActionFinish () { return HasFSM() && m_FSM.IsRunning() && m_FSM.GetCurrentState().IsWaitingForActionFinish(); }
108
113 bool IsIdle () { return false; }
114
120 void OnSubMachineChanged (BotStateBase src, BotStateBase dst) { }
121
127 void OnStateChanged (BotStateBase src, BotStateBase dst) { }
128};
129
130class BotStateIdle : BotStateBase
131{
132 void BotStateIdle (Bot bot = NULL, BotStateBase parent = NULL) { m_Bot = bot; m_Owner = m_Bot.m_Owner; m_ParentState = parent; }
133
134 override bool IsIdle () { return true; }
135};
136#endif
proto string ToString()
HandStateEquipped OnEntry
Определения WeaponChambering.c:292
string Type
Определения JsonDataContaminatedArea.c:11
enum ProcessDirectDamageFlags m_Owner
void ProcessEvent(EPresenceNotifierNoiseEventType pEventType)
processing of external one-time events (land, fire, etc.)
Определения PluginPresenceNotifier.c:207
override void OnAbort()
Определения RemoteDetonator.c:300
FSMTransition
Определения Weapon_Base.c:12
class WeaponChambering extends WeaponStateBase IsWaitingForActionFinish
Определения WeaponChambering.c:291
class WeaponChambering_Chamber_OnEntry extends WeaponChambering_Base OnExit
Определения WeaponChambering.c:352
override bool IsIdle()
Определения WeaponStableState.c:95
override bool IsWaitingForActionFinish()
waiting for active animation action/actionType finish
Определения WeaponChamberingLooped.c:9
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
proto native void OnUpdate()
Определения 3_Game/DayZ/tools/tools.c:349