Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс BotStateBase

represent weapon state base Подробнее...

+ Граф наследования:BotStateBase:

Защищенные члены

void BotTimedWait (Bot bot=NULL, BotStateBase parent=NULL, float timeout=3.0)
 
override void OnEntry (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
void OnTimeout ()
 

Защищенные данные

float m_Timeout = 3.0
 
bool m_Periodic = true
 

Закрытые члены

void BotHunt (Bot bot=NULL, BotStateBase parent=NULL)
 
void SelectTarget ()
 
override void OnEntry (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
override void OnEntry (BotEventBase e)
 
override void OnAbort (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
override void OnEntry (BotEventBase e)
 
override void OnAbort (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
void BotTestAttachAndDropCycle (Bot bot=NULL, BotStateBase parent=NULL)
 
override void OnEntry (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
override void OnEntry (BotEventBase e)
 
override void OnAbort (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
override void OnEntry (BotEventBase e)
 
override void OnAbort (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
void BotTestItemMoveBackAndForth (Bot bot=NULL, BotStateBase parent=NULL)
 
override void OnEntry (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
override void OnEntry (BotEventBase e)
 
override void OnAbort (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
int GetNextSlot (int curr)
 
override void OnUpdate (float dt)
 
void BotSpawnEntityInHands (Bot bot=NULL, BotStateBase parent=NULL, string new_type="")
 
override void OnEntry (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
override void OnEntry (BotEventBase e)
 
override void OnAbort (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
void Bot_TestSpawnOpen (Bot bot=NULL, BotStateBase parent=NULL, string new_type="")
 
override void OnEntry (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
override void OnEntry (BotEventBase e)
 
override void OnAbort (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
void BotStateBase (Bot bot=NULL, BotStateBase parent=NULL)
 nested state machine (or null)
 
PlayerBase GetPlayerOwner ()
 
void SetParentState (BotStateBase parent)
 allows construction of hierarchical state machine
 
BotStateBase GetParentState ()
 
bool HasFSM ()
 
BotFSM GetFSM ()
 
bool ProcessEvent (BotEventBase e)
 
void AddTransition (FSMTransition< BotStateBase, BotEventBase, BotActionBase, BotGuardBase > t)
 adds transition into m_FSM transition table
 
void OnEntry (BotEventBase e)
 
void OnUpdate (float dt)
 
void OnAbort (BotEventBase e)
 
void OnExit (BotEventBase e)
 
bool IsWaitingForActionFinish ()
 waiting for active animation action/actionType finish
 
bool IsIdle ()
 idle state does not expect any animation events
 
void OnSubMachineChanged (BotStateBase src, BotStateBase dst)
 called when sub-machine has changed its state
 
void OnStateChanged (BotStateBase src, BotStateBase dst)
 called on current state when state machine has changed its state
 

Закрытые данные

Man m_Target
 
float m_dtAccumulator = 0.0
 
ref BotHunt_Tracking m_Tracking
 
ref BotHunt_Hunting m_Hunting
 
EntityAI m_Target
 
bool m_TargetInSight = false
 
bool m_TargetLost = false
 
bool m_Tracking = true
 
EntityAI m_Entity
 
ref BotTestAttachAndDropCycle_Detaching m_Detaching
 
ref BotTestAttachAndDropCycle_Attaching m_Attaching
 
ref BotTestItemMoveBackAndForth_MoveFromSlotToSlot m_Move
 
int m_WaitingForSlot = InventorySlots.INVALID
 
int m_hgSlot = InventorySlots.GetSlotIdFromString("Headgear")
 
int m_mskSlot = InventorySlots.GetSlotIdFromString("Mask")
 
string m_Type
 
ref BotSpawnEntityInHands m_Spawning
 
ref BotOpenEntityInHands m_Opening
 
PlayerBase m_Owner
 
Bot m_Bot
 man that this state belongs to
 
BotStateBase m_ParentState
 bot that this state belongs to
 
ref BotFSM m_FSM
 hierarchical parent state of this state (or null)
 

Подробное описание

represent weapon state base

Class comes with entry/update/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.

Конструктор(ы)

◆ BotStateBase()

void BotStateBase ( Bot bot = NULL,
BotStateBase parent = NULL )
inlineprivate

nested state machine (or null)

17{ m_Bot = bot; m_Owner = bot.m_Owner; m_ParentState = parent; }
PlayerBase m_Owner
Definition BotStates.c:12
Bot m_Bot
man that this state belongs to
Definition BotStates.c:13
BotStateBase m_ParentState
bot that this state belongs to
Definition BotStates.c:14
Definition EntityAI.c:95

Перекрестные ссылки m_Bot, m_Owner и m_ParentState.

Методы

◆ AddTransition()

AddTransition ( FSMTransition< BotStateBase, BotEventBase, BotActionBase, BotGuardBase > t)
inlineprivate

adds transition into m_FSM transition table

44 {
45 if (HasFSM())
46 m_FSM.AddTransition(t);
47 else
48 Error("[botfsm] adding transition to state without FSM. Configure FSM first.");
49 }
bool HasFSM()
Definition BotStates.c:30
ref BotFSM m_FSM
hierarchical parent state of this state (or null)
Definition BotStates.c:15
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

Перекрестные ссылки Error(), HasFSM() и m_FSM.

◆ Bot_TestSpawnOpen()

void Bot_TestSpawnOpen ( Bot bot = NULL,
BotStateBase parent = NULL,
string new_type = "" )
inlineprivate
100 {
102
103 // setup nested state machine
104 m_FSM = new BotFSM(this); // @NOTE: set owner of the submachine fsm
105
108
109 // events
111
112 // transitions
113 m_FSM.AddTransition(new BotTransition( m_Spawning, __EntInH__, m_Opening));
114 //m_FSM.AddTransition(new BotTransition( m_Opening, __EntAtt__, m_Eating));
115 //m_FSM.AddTransition(new BotTransition( m_Eating, __EntAtt__, m_Eating));
116
117 m_FSM.SetInitialState(m_Spawning);
118 }
FSMTransition< BotStateBase, BotEventBase, BotActionBase, BotGuardBase > BotTransition
Definition BotFSM.c:7
represents event that triggers transition from state to state
Definition BotEvents.c:5
Definition Bot_TestSpawnAndOpenCan.c:1
Bot Finite State Machine (Hierarchical)
void BotSpawnEntityInHands(Bot bot=NULL, BotStateBase parent=NULL, string new_type="")
Definition Bot_TestSpawnAndOpenCan.c:7
string m_Type
Definition Bot_TestSpawnAndOpenCan.c:5
ref BotSpawnEntityInHands m_Spawning
Definition Bot_TestSpawnAndOpenCan.c:96
ref BotOpenEntityInHands m_Opening
Definition Bot_TestSpawnAndOpenCan.c:97

Перекрестные ссылки m_Type.

◆ BotHunt()

void BotHunt ( Bot bot = NULL,
BotStateBase parent = NULL )
inlineprivate
24 {
25 // setup nested state machine
26 m_FSM = new BotFSM(this); // @NOTE: set owner of the submachine fsm
27
29 m_Hunting = new BotHunt_Hunting(m_Bot, this);
30
31 // events
34
35 // transitions
36 m_FSM.AddTransition(new BotTransition( m_Tracking, __InSight__, m_Hunting));
37 m_FSM.AddTransition(new BotTransition( m_Hunting, __Lost__ , m_Tracking));
38
39 m_FSM.SetInitialState(m_Tracking);
40 }
Definition Bot_Hunt.c:3
Definition Bot_Hunt.c:9
ref BotHunt_Tracking m_Tracking
Definition Bot_Hunt.c:20
ref BotHunt_Hunting m_Hunting
Definition Bot_Hunt.c:21

◆ BotSpawnEntityInHands()

void BotSpawnEntityInHands ( Bot bot = NULL,
BotStateBase parent = NULL,
string new_type = "" )
inlineprivate
8 {
9 if (new_type == string.Empty)
10 m_Type = "TunaCan";
11 else
13 }
Empty
Definition Hand_States.c:14

Перекрестные ссылки Empty и m_Type.

◆ BotTestAttachAndDropCycle()

void BotTestAttachAndDropCycle ( Bot bot = NULL,
BotStateBase parent = NULL )
inlineprivate
12 {
13 // setup nested state machine
14 m_FSM = new BotFSM(this); // @NOTE: set owner of the submachine fsm
15
18
19 // events
22
23 // transitions
26
27 m_FSM.SetInitialState(m_Detaching);
28 }
Definition Bot_TestAttachAndDropCycle.c:1
Definition Bot_TestAttachAndDropCycle.c:3
ref BotTestAttachAndDropCycle_Attaching m_Attaching
Definition Bot_TestAttachAndDropCycle.c:9
ref BotTestAttachAndDropCycle_Detaching m_Detaching
Definition Bot_TestAttachAndDropCycle.c:8

◆ BotTestItemMoveBackAndForth()

void BotTestItemMoveBackAndForth ( Bot bot = NULL,
BotStateBase parent = NULL )
inlineprivate
7 {
8 // setup nested state machine
9 m_FSM = new BotFSM(this); // @NOTE: set owner of the submachine fsm
10
12
13 // events
15
16 // transitions
17 m_FSM.AddTransition(new BotTransition( m_Move, __EntAtt__, m_Move));
18
19 m_FSM.SetInitialState(m_Move);
20 }
ref BotTestItemMoveBackAndForth_MoveFromSlotToSlot m_Move
Definition Bot_TestItemMoveBackAndForth.c:4

◆ BotTimedWait()

void BotTimedWait ( Bot bot = NULL,
BotStateBase parent = NULL,
float timeout = 3.0 )
inlineprotected
11 {
13 }
float m_Timeout
Definition Bot_TimedWait.c:7

◆ GetFSM()

BotFSM GetFSM ( )
inlineprivate
31{ return m_FSM; }

Перекрестные ссылки m_FSM.

◆ GetNextSlot()

int GetNextSlot ( int curr)
inlineprivate
80 {
81 if (curr == m_hgSlot)
82 return m_mskSlot;
83 if (curr == m_mskSlot)
84 return m_hgSlot;
85 Error("EE2");
87 }
int m_mskSlot
Definition Bot_TestItemMoveBackAndForth.c:65
int m_hgSlot
Definition Bot_TestItemMoveBackAndForth.c:64
provides access to slot configuration
Definition InventorySlots.c:6
const int INVALID
Invalid slot (-1)
Definition InventorySlots.c:17

Перекрестные ссылки Error() и InventorySlots::INVALID.

◆ GetParentState()

GetParentState ( )
inlineprivate
Возвращает
state that owns this sub-state (or null if plain state)
28{ return m_ParentState; }

Перекрестные ссылки m_ParentState.

◆ GetPlayerOwner()

PlayerBase GetPlayerOwner ( )
inlineprivate
19{ return m_Owner; }

Перекрестные ссылки m_Owner.

Используется в SelectTarget().

◆ HasFSM()

bool HasFSM ( )
inlineprivate
30{ return m_FSM != NULL; }

Перекрестные ссылки m_FSM.

Используется в AddTransition(), IsWaitingForActionFinish(), OnAbort(), OnEntry(), OnUpdate() и ProcessEvent().

◆ IsIdle()

IsIdle ( )
inlineprivate

idle state does not expect any animation events

Возвращает
true if this state is idle
112{ return false; }

◆ IsWaitingForActionFinish()

IsWaitingForActionFinish ( )
inlineprivate

waiting for active animation action/actionType finish

Возвращает
true if this state or active substate is waiting for finish signal
106{ return HasFSM() && m_FSM.IsRunning() && m_FSM.GetCurrentState().IsWaitingForActionFinish(); }

Перекрестные ссылки HasFSM() и m_FSM.

◆ OnAbort() [1/8]

override void OnAbort ( BotEventBase e)
inlineprivate
106 {
107 m_TargetLost = false;
108 m_TargetInSight = false;
109 m_Tracking = false;
110
111 super.OnAbort(e);
112 }
bool m_TargetInSight
Definition Bot_Hunt.c:92
bool m_TargetLost
Definition Bot_Hunt.c:93

◆ OnAbort() [2/8]

override void OnAbort ( BotEventBase e)
inlineprivate
183{ super.OnAbort(e); }

◆ OnAbort() [3/8]

override void OnAbort ( BotEventBase e)
inlineprivate
61{ super.OnAbort(e); }

◆ OnAbort() [4/8]

override void OnAbort ( BotEventBase e)
inlineprivate
97{ super.OnAbort(e); }

◆ OnAbort() [5/8]

override void OnAbort ( BotEventBase e)
inlineprivate
72{ super.OnAbort(e); }

◆ OnAbort() [6/8]

override void OnAbort ( BotEventBase e)
inlineprivate
66{ super.OnAbort(e); }

◆ OnAbort() [7/8]

override void OnAbort ( BotEventBase e)
inlineprivate
131{ super.OnAbort(e); }

◆ OnAbort() [8/8]

void OnAbort ( BotEventBase e)
inlineprivate
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 }
void botDebugPrint(string s)
Definition Bot.c:182
proto string ToString()
string Type
Definition JsonDataContaminatedArea.c:11

Перекрестные ссылки botDebugPrint(), HasFSM(), m_FSM, ToString() и Type.

◆ OnEntry() [1/14]

override void OnEntry ( BotEventBase e)
inlineprivate
51 {
52 m_dtAccumulator = 0.0;
54
55 super.OnEntry(e);
56 }
void SelectTarget()
Definition Bot_Hunt.c:42
float m_dtAccumulator
Definition Bot_Hunt.c:18

Перекрестные ссылки m_dtAccumulator и SelectTarget().

◆ OnEntry() [2/14]

override void OnEntry ( BotEventBase e)
inlineprivate
97 {
98 super.OnEntry(e);
99
100 m_TargetLost = false;
101 m_TargetInSight = false;
102 m_Tracking = false;
103 }

◆ OnEntry() [3/14]

override void OnEntry ( BotEventBase e)
inlineprivate
179 {
180 super.OnEntry(e);
181 }

◆ OnEntry() [4/14]

override void OnEntry ( BotEventBase e)
inlineprivate
31 {
32 m_Entity = m_Owner.GetInventory().CreateAttachment("TaloonBag_Orange");
33 m_Detaching.m_Entity = m_Entity;
34 m_Attaching.m_Entity = m_Entity;
35
36 super.OnEntry(e);
37 }
EntityAI m_Entity
Definition Bot_TestAttachAndDropCycle.c:7

Перекрестные ссылки m_Entity, m_Entity и m_Owner.

◆ OnEntry() [5/14]

override void OnEntry ( BotEventBase e)
inlineprivate
57 {
58 super.OnEntry(e);
59 }

◆ OnEntry() [6/14]

override void OnEntry ( BotEventBase e)
inlineprivate
93 {
94 super.OnEntry(e);
95 }

◆ OnEntry() [7/14]

override void OnEntry ( BotEventBase e)
inlineprivate
23 {
24 //m_Entity = m_Owner.GetInventory().CreateAttachment("TaloonBag_Orange");
25 //m_Entity = m_Owner.GetInventory().FindAttachment();
26 EntityAI hgear = m_Owner.GetInventory().FindAttachment( InventorySlots.GetSlotIdFromString("Headgear") );
27 EntityAI mask = m_Owner.GetInventory().FindAttachment( InventorySlots.GetSlotIdFromString("Mask") );
28
29 if (hgear)
31 if (mask)
32 m_Entity = mask;
33
34
36 if (m_Entity.GetInventory().GetCurrentInventoryLocation(loc))
37 {
38 m_Move.m_WaitingForSlot = loc.GetSlot();
39 }
40 else
41 Error("EE");
42 m_Move.m_Entity = m_Entity;
43
44 super.OnEntry(e);
45 }
Definition Building.c:6
InventoryLocation.
Definition InventoryLocation.c:28
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id

Перекрестные ссылки Error(), InventorySlots::GetSlotIdFromString(), m_Entity, m_Entity и m_Owner.

◆ OnEntry() [8/14]

override void OnEntry ( BotEventBase e)
inlineprivate
68 {
69 super.OnEntry(e);
70 }

◆ OnEntry() [9/14]

override void OnEntry ( BotEventBase e)
inlineprivate
16 {
17 super.OnEntry(e);
18
19 if (m_Owner.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
20 {
21 m_Owner.GetHumanInventory().CreateInHands(m_Type);
22 }
23 }
DayZPlayerInstanceType
defined in C++
Definition dayzplayer.c:1059

Перекрестные ссылки m_Owner и m_Type.

◆ OnEntry() [10/14]

override void OnEntry ( BotEventBase e)
inlineprivate
47 {
48 super.OnEntry(e);
49
50 if (m_Owner.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
51 {
53 if (ev_ih)
54 {
55 m_Entity = ev_ih.m_Entity;
57 if (b)
58 {
59 botDebugPrint("[bot] + " + m_Owner + " will open edible item=" + b + " bot=" + m_Owner);
60 b.Open();
61 }
62 }
63 }
64 }
Definition Edible_Base.c:2

Перекрестные ссылки botDebugPrint(), m_Entity и m_Owner.

◆ OnEntry() [11/14]

override void OnEntry ( BotEventBase e)
inlineprivate
120{ super.OnEntry(e); }

◆ OnEntry() [12/14]

override void OnEntry ( BotEventBase e)
inlineprivate
130{ super.OnEntry(e); }

◆ OnEntry() [13/14]

override void OnEntry ( BotEventBase e)
inlineprotected
16 {
17 m_dtAccumulator = 0.0;
18
19 super.OnEntry(e);
20 }

Перекрестные ссылки m_dtAccumulator.

◆ OnEntry() [14/14]

void OnEntry ( BotEventBase e)
inlineprivate
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 }

Перекрестные ссылки botDebugPrint(), HasFSM(), m_FSM, ToString() и Type.

◆ OnExit() [1/14]

override void OnExit ( BotEventBase e)
inlineprivate
59 {
60 m_dtAccumulator = 0.0;
61 m_Target = null;
62
63 super.OnExit(e);
64 }
Man m_Target
Definition Bot_Hunt.c:17

Перекрестные ссылки m_dtAccumulator и m_Target.

◆ OnExit() [2/14]

override void OnExit ( BotEventBase e)
inlineprivate
115 {
116 m_TargetLost = false;
117 m_TargetInSight = false;
118 m_Tracking = false;
119
120 super.OnExit(e);
121 }

◆ OnExit() [3/14]

override void OnExit ( BotEventBase e)
inlineprivate
186 {
187 super.OnExit(e);
188 }

◆ OnExit() [4/14]

override void OnExit ( BotEventBase e)
inlineprivate
40 {
41 m_Entity = null;
42
43 super.OnExit(e);
44 }

Перекрестные ссылки m_Entity.

◆ OnExit() [5/14]

override void OnExit ( BotEventBase e)
inlineprivate
64 {
65 super.OnExit(e);
66 }

◆ OnExit() [6/14]

override void OnExit ( BotEventBase e)
inlineprivate
100 {
101 super.OnExit(e);
102 }

◆ OnExit() [7/14]

override void OnExit ( BotEventBase e)
inlineprivate
48 {
49 m_Entity = null;
50
51 super.OnExit(e);
52 }

Перекрестные ссылки m_Entity.

◆ OnExit() [8/14]

override void OnExit ( BotEventBase e)
inlineprivate
75 {
76 super.OnExit(e);
77 }

◆ OnExit() [9/14]

override void OnExit ( BotEventBase e)
inlineprivate
25{ super.OnExit(e); }

◆ OnExit() [10/14]

override void OnExit ( BotEventBase e)
inlineprivate
69 {
70 super.OnExit(e);
71 }

◆ OnExit() [11/14]

override void OnExit ( BotEventBase e)
inlineprivate
121{ super.OnExit(e); }

◆ OnExit() [12/14]

override void OnExit ( BotEventBase e)
inlineprivate
132{ super.OnExit(e); }

◆ OnExit() [13/14]

override void OnExit ( BotEventBase e)
inlineprotected
23 {
24 m_dtAccumulator = 0.0;
25
26 super.OnExit(e);
27 }

Перекрестные ссылки m_dtAccumulator.

◆ OnExit() [14/14]

void OnExit ( BotEventBase e)
inlineprivate
98 {
99 botDebugPrint("[botfsm] } " + this.Type().ToString());
100 }

Перекрестные ссылки botDebugPrint(), ToString() и Type.

◆ OnStateChanged()

OnStateChanged ( BotStateBase src,
BotStateBase dst )
inlineprivate

called on current state when state machine has changed its state

Аргументы
[in]srcfrom state (previous)
[in]dstto state (current)
126{ }

◆ OnSubMachineChanged()

OnSubMachineChanged ( BotStateBase src,
BotStateBase dst )
inlineprivate

called when sub-machine has changed its state

Аргументы
[in]srcfrom state (previous)
[in]dstto state (current)
119{ }

◆ OnTimeout()

void OnTimeout ( )
inlineprotected
48 {
49 botDebugSpam("[bot] + " + m_Owner + " BotTimedWait::OnTimeout");
51 }
void botDebugSpam(string s)
Definition Bot.c:191
Definition Bot_TimedWait.c:2
bool ProcessEvent(BotEventBase e)
Definition Bot.c:167

Перекрестные ссылки botDebugSpam() и m_Owner.

◆ OnUpdate() [1/14]

override void OnUpdate ( float dt)
inlineprivate
67 {
68 super.OnUpdate(dt);
69
71
72 /*float rescanTime = 3.0;
73 if (m_dtAccumulator >= rescanTime)
74 if (m_weapon.CanProcessWeaponEvents())
75 m_Bot.ProcessEvent(new WeaponEventReloadTimeout(p));*/
76
77 if (m_Target == null)
78 {
79 int acc = m_dtAccumulator;
80 if (acc % 5 == 0)
81 {
82 Print("Searching...");
84 }
85 }
86 }
proto void Print(void var)
Prints content of variable to console/log.

Перекрестные ссылки m_dtAccumulator, m_dtAccumulator, m_Target, Print() и SelectTarget().

◆ OnUpdate() [2/14]

override void OnUpdate ( float dt)
inlineprivate
124 {
125 if (m_Target)
126 {
127 m_Tracking = true;
128 vector targetPos = m_Target.GetPosition();
129 botDebugPrint("[bot] + " + m_Owner + " hunt Tracking target=" + m_Target + " pos=" + targetPos);
130
131 // tmp dist check
132 float d = vector.Distance(m_Target.GetPosition(), GetPlayerOwner().GetPosition());
133 if (d < 2.0)
134 {
135 m_TargetInSight = true;
136 }
137 else
138 {
139 m_TargetInSight = false;
140 }
141
142 if (!m_TargetInSight)
143 {
144 GetPlayerOwner().GetInputController().OverrideMovementSpeed(true, 1);
145 GetPlayerOwner().GetInputController().OverrideMovementAngle(true, 1);
146 }
147 else
148 {
149 GetPlayerOwner().GetInputController().OverrideMovementSpeed(false, 0);
150 GetPlayerOwner().GetInputController().OverrideMovementAngle(false, 0);
151 }
152
153 /*if ((.GetInputController().LimitsIsSprintDisabled()))
154 .GetInputController().OverrideMovementSpeed( true, 2 );
155 else
156 .GetInputController().OverrideMovementSpeed( true, 3 );*/
157
158 }
159 else
160 {
161 if (m_Tracking)
162 {
163 m_TargetLost = true;
164 m_TargetInSight = false;
165 m_Tracking = false;
166
167 GetPlayerOwner().GetInputController().OverrideMovementSpeed(false, 0);
168 GetPlayerOwner().GetInputController().OverrideMovementAngle(false, 0);
169 }
170 }
171 }
class JsonUndergroundAreaTriggerData GetPosition
Definition UndergroundAreaLoader.c:9
PlayerBase GetPlayerOwner()
Definition BotStates.c:19
Definition EnConvert.c:106
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.

Перекрестные ссылки botDebugPrint(), vector::Distance(), GetPosition, m_Owner и m_Target.

◆ OnUpdate() [3/14]

override void OnUpdate ( float dt)
inlineprivate
191 {
192 }

◆ OnUpdate() [4/14]

override void OnUpdate ( float dt)
inlineprivate
47 {
48 super.OnUpdate(dt);
49 }

◆ OnUpdate() [5/14]

override void OnUpdate ( float dt)
inlineprivate
69 {
70 if (m_Entity)
71 {
72 botDebugPrint("[bot] + " + m_Owner + " drop item=" + m_Entity + " bot=" + m_Owner);
73
74 m_Owner.PredictiveDropEntity(m_Entity);
75
77 if (m_Entity.GetInventory().GetCurrentInventoryLocation(loc))
78 {
79 if (loc.GetType() == InventoryLocationType.GROUND)
80 {
82 }
83 }
84 }
85 }
InventoryLocationType
types of Inventory Location
Definition InventoryLocation.c:4

Перекрестные ссылки botDebugPrint(), m_Entity и m_Owner.

◆ OnUpdate() [6/14]

override void OnUpdate ( float dt)
inlineprivate
105 {
106 if (m_Entity)
107 {
108 botDebugPrint("[bot] + " + m_Owner + " att item=" + m_Entity + " bot=" + m_Owner);
109
110 if (m_Owner.GetInventory().CanAddAttachment(m_Entity))
111 {
112 m_Owner.PredictiveTakeEntityAsAttachment(m_Entity);
113
115 if (m_Entity.GetInventory().GetCurrentInventoryLocation(loc))
116 {
117 if (loc.GetType() == InventoryLocationType.ATTACHMENT)
118 {
120 }
121 }
122 }
123 }
124 }

Перекрестные ссылки botDebugPrint(), m_Entity и m_Owner.

◆ OnUpdate() [7/14]

override void OnUpdate ( float dt)
inlineprivate
55 {
56 super.OnUpdate(dt);
57 }

◆ OnUpdate() [8/14]

override void OnUpdate ( float dt)
inlineprivate
90 {
91 if (m_Entity)
92 {
93 botDebugPrint("[bot] + " + m_Owner + " move item=" + m_Entity);
94
96 if (m_Entity.GetInventory().GetCurrentInventoryLocation(loc))
97 {
98 if (loc.GetType() == InventoryLocationType.ATTACHMENT)
99 {
100 if (loc.GetSlot() == m_WaitingForSlot)
101 {
103 botDebugPrint("[bot] + " + m_Owner + " will switch slot=" + nextSlot + " for item=" + m_Entity);
104
106
107 m_Owner.PredictiveTakeEntityAsAttachmentEx(m_Entity, nextSlot);
108 //m_Bot.ProcessEvent(new BotEventEntityDet(m_Owner, m_Entity));
109 }
110 }
111 }
112 }
113 }
int m_WaitingForSlot
Definition Bot_TestItemMoveBackAndForth.c:63
int GetNextSlot(int curr)
Definition Bot_TestItemMoveBackAndForth.c:79

Перекрестные ссылки botDebugPrint(), m_Entity и m_Owner.

◆ OnUpdate() [9/14]

override void OnUpdate ( float dt)
inlineprivate
28 {
29 super.OnUpdate(dt);
30
31 EntityAI inHands = m_Owner.GetHumanInventory().GetEntityInHands();
32 if (inHands)
33 {
34 botDebugPrint("[bot] + " + m_Owner + " hand item=" + inHands + " bot=" + m_Owner);
36 }
37 }

Перекрестные ссылки botDebugPrint() и m_Owner.

◆ OnUpdate() [10/14]

override void OnUpdate ( float dt)
inlineprivate
74 {
75 super.OnUpdate(dt);
76
77 EntityAI inHands = m_Owner.GetHumanInventory().GetEntityInHands();
78 botDebugSpam("[bot] + " + m_Owner + " wait for opened item inHands=" + inHands + " bot=" + m_Owner);
79 if (inHands)
80 {
81 string t_str = inHands.GetType();
82 //string t_str = t.ToString();
83 if (t_str.IndexOf("_Opened") != -1)
84 {
85 botDebugPrint("[bot] + " + m_Owner + " opened item=" + inHands + " bot=" + m_Owner);
87 }
88 }
89 }
Definition Bot_TestSpawnAndOpenCan.c:40

Перекрестные ссылки botDebugPrint(), botDebugSpam() и m_Owner.

◆ OnUpdate() [11/14]

override void OnUpdate ( float dt)
inlineprivate
122{ super.OnUpdate(dt); }

◆ OnUpdate() [12/14]

override void OnUpdate ( float dt)
inlineprivate
135 {
136 super.OnUpdate(dt);
137
138 EntityAI inHands = m_Owner.GetHumanInventory().GetEntityInHands();
139 botDebugSpam("[bot] + " + m_Owner + " waiting for empty hands, inHands=" + inHands + " bot=" + m_Owner);
140 if (!inHands)
141 {
142 botDebugPrint("[bot] + " + m_Owner + " hand slot empty. bot=" + m_Owner);
144 }
145 }
Definition Bot_TestSpawnAndOpenCan.c:126

Перекрестные ссылки botDebugPrint(), botDebugSpam() и m_Owner.

◆ OnUpdate() [13/14]

override void OnUpdate ( float dt)
inlineprotected
30 {
31 super.OnUpdate(dt);
32
34
35 float rescanTime = m_Timeout;
37 {
38 OnTimeout();
39
40 if (m_Periodic)
41 m_dtAccumulator = 0.0;
42 else
43 m_dtAccumulator = -1.0;
44 }
45 }
bool m_Periodic
Definition Bot_TimedWait.c:8
void OnTimeout()
Definition Bot_TimedWait.c:47

Перекрестные ссылки m_dtAccumulator и OnTimeout().

◆ OnUpdate() [14/14]

void OnUpdate ( float dt)
inlineprivate
74 {
75 if (HasFSM() && m_FSM.IsRunning())
76 m_FSM.GetCurrentState().OnUpdate(dt);
77 }

Перекрестные ссылки HasFSM() и m_FSM.

◆ ProcessEvent()

bool ProcessEvent ( BotEventBase e)
inlineprivate
34 {
35 if (HasFSM())
36 return m_FSM.ProcessEvent(e);
37 return false;
38 }

Перекрестные ссылки HasFSM() и m_FSM.

◆ SelectTarget()

void SelectTarget ( )
inlineprivate
43 {
45 m_Tracking.m_Target = m_Target;
46 m_Hunting.m_Target = m_Target;
47 botDebugPrint("[bot] + " + m_Owner + " hunt SelectTarget target=" + m_Target);
48 }
Man BotSelectNearestTarget(EntityAI bot)
Definition Bot_Hunt.c:195

Перекрестные ссылки botDebugPrint(), BotSelectNearestTarget(), GetPlayerOwner(), m_Owner, m_Target и m_Target.

Используется в OnEntry() и OnUpdate().

◆ SetParentState()

SetParentState ( BotStateBase parent)
inlineprivate

allows construction of hierarchical state machine

24{ m_ParentState = parent; }

Перекрестные ссылки m_ParentState.

Поля

◆ m_Attaching

◆ m_Bot

Bot m_Bot
private

man that this state belongs to

Используется в BotStateBase(), BotStateIdle::BotStateIdle() и BotTestSpamUserActions::BotTestSpamUserActions().

◆ m_Detaching

◆ m_dtAccumulator

float m_dtAccumulator = 0.0
private

Используется в OnUpdate().

◆ m_Entity

EntityAI m_Entity
private

Используется в OnEntry().

◆ m_FSM

ref BotFSM m_FSM
private

hierarchical parent state of this state (or null)

Используется в AddTransition(), BotTestSpamUserActions::BotTestSpamUserActions(), GetFSM(), HasFSM(), IsWaitingForActionFinish(), OnAbort(), OnEntry(), OnUpdate() и ProcessEvent().

◆ m_hgSlot

int m_hgSlot = InventorySlots.GetSlotIdFromString("Headgear")
private

◆ m_Hunting

ref BotHunt_Hunting m_Hunting
private

◆ m_Move

◆ m_mskSlot

int m_mskSlot = InventorySlots.GetSlotIdFromString("Mask")
private

◆ m_Opening

ref BotOpenEntityInHands m_Opening
private

◆ m_Owner

◆ m_ParentState

BotStateBase m_ParentState
private

bot that this state belongs to

Используется в BotStateBase(), BotStateIdle::BotStateIdle(), GetParentState() и SetParentState().

◆ m_Periodic

bool m_Periodic = true
protected

◆ m_Spawning

ref BotSpawnEntityInHands m_Spawning
private

◆ m_Target [1/2]

EntityAI m_Target
private

Используется в SelectTarget().

◆ m_Target [2/2]

EntityAI m_Target
private

◆ m_TargetInSight

bool m_TargetInSight = false
private

◆ m_TargetLost

bool m_TargetLost = false
private

◆ m_Timeout

float m_Timeout = 3.0
protected

◆ m_Tracking [1/2]

ref BotHunt_Tracking m_Tracking
private

◆ m_Tracking [2/2]

bool m_Tracking = true
private

◆ m_Type

string m_Type
private

◆ m_WaitingForSlot

int m_WaitingForSlot = InventorySlots.INVALID
private

Объявления и описания членов классов находятся в файлах: