DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Bot_TestAttachAndDropCycle.c
См. документацию.
2
4
5class BotTestAttachAndDropCycle extends BotStateBase
6{
8 ref BotTestAttachAndDropCycle_Detaching m_Detaching;
9 ref BotTestAttachAndDropCycle_Attaching m_Attaching;
10
11 void BotTestAttachAndDropCycle (Bot bot = NULL, BotStateBase parent = NULL)
12 {
13 // setup nested state machine
14 m_FSM = new BotFSM(this); // @NOTE: set owner of the submachine fsm
15
16 m_Detaching = new BotTestAttachAndDropCycle_Detaching(m_Bot, this);
17 m_Attaching = new BotTestAttachAndDropCycle_Attaching(m_Bot, this);
18
19 // events
20 BotEventBase __EntAtt__ = new BotEventEntityAttached;
21 BotEventBase __EntDet__ = new BotEventEntityDetached;
22
23 // transitions
24 m_FSM.AddTransition(new BotTransition( m_Detaching, __EntDet__, m_Attaching));
25 m_FSM.AddTransition(new BotTransition( m_Attaching, __EntAtt__, m_Detaching));
26
27 m_FSM.SetInitialState(m_Detaching);
28 }
29
30 override void OnEntry (BotEventBase e)
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 }
38
39 override void OnExit (BotEventBase e)
40 {
41 m_Entity = null;
42
43 super.OnExit(e);
44 }
45
46 override void OnUpdate (float dt)
47 {
48 super.OnUpdate(dt);
49 }
50};
51
52class BotTestAttachAndDropCycle_Detaching extends BotStateBase
53{
55
56 override void OnEntry (BotEventBase e)
57 {
58 super.OnEntry(e);
59 }
60
61 override void OnAbort (BotEventBase e) { super.OnAbort(e); }
62
63 override void OnExit (BotEventBase e)
64 {
65 super.OnExit(e);
66 }
67
68 override void OnUpdate (float dt)
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 {
81 m_Bot.ProcessEvent(new BotEventEntityDetached(m_Owner, m_Entity));
82 }
83 }
84 }
85 }
86};
87
88class BotTestAttachAndDropCycle_Attaching extends BotStateBase
89{
91
92 override void OnEntry (BotEventBase e)
93 {
94 super.OnEntry(e);
95 }
96
97 override void OnAbort (BotEventBase e) { super.OnAbort(e); }
98
99 override void OnExit (BotEventBase e)
100 {
101 super.OnExit(e);
102 }
103
104 override void OnUpdate (float dt)
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 {
119 m_Bot.ProcessEvent(new BotEventEntityAttached(m_Owner, m_Entity));
120 }
121 }
122 }
123 }
124 }
125};
126
class LogManager EntityAI
EntityAI m_Entity
Определения ActionDebug.c:11
void botDebugPrint(string s)
Определения Bot.c:122
FSMTransition< BotStateBase, BotEventBase, BotActionBase, BotGuardBase > BotTransition
Определения BotFSM.c:7
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
void BotEventBase(PlayerBase p=NULL, EntityAI e=NULL)
Определения BotEvents.c:9
represents event that triggers transition from state to state
Определения BotEvents.c:5
Bot Finite State Machine (Hierarchical)
Определения Bot.c:19
ref BotTestAttachAndDropCycle_Attaching m_Attaching
Определения Bot_TestAttachAndDropCycle.c:9
PlayerBase m_Owner
Определения BotStates.c:12
ref BotTestAttachAndDropCycle_Detaching m_Detaching
Определения Bot_TestAttachAndDropCycle.c:8
void BotStateBase(Bot bot=NULL, BotStateBase parent=NULL)
nested state machine (or null)
Определения BotStates.c:17
void BotTestAttachAndDropCycle(Bot bot=NULL, BotStateBase parent=NULL)
Определения Bot_TestAttachAndDropCycle.c:11
ref BotFSM m_FSM
hierarchical parent state of this state (or null)
Определения BotStates.c:15
override void OnUpdate(float dt)
Определения Bot_TestAttachAndDropCycle.c:46
override void OnEntry(BotEventBase e)
Определения Bot_TestAttachAndDropCycle.c:30
override void OnAbort(BotEventBase e)
Определения Bot_TestAttachAndDropCycle.c:61
override void OnExit(BotEventBase e)
Определения Bot_TestAttachAndDropCycle.c:39
EntityAI m_Entity
Определения Bot_TestAttachAndDropCycle.c:7
Bot m_Bot
man that this state belongs to
Определения BotStates.c:13
represent weapon state base
Определения Bot_Hunt.c:16
Определения Building.c:6
proto native int GetType()
returns type of InventoryLocation
InventoryLocation.
Определения InventoryLocation.c:29