DayZ 1.24
Loading...
Searching...
No Matches
Bot_TestAttachAndDropCycle.c
Go to the documentation of this file.
2
4
5class BotTestAttachAndDropCycle extends BotStateBase
6{
10
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
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
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 m_Bot.ProcessEvent(new BotEventEntityDetached(m_Owner, m_Entity));
81 }
82 }
83 }
84};
85
87{
89
90 override void OnEntry(BotEventBase e)
91 {
92 super.OnEntry(e);
93 }
94
95 override void OnAbort(BotEventBase e) { super.OnAbort(e); }
96
97 override void OnExit(BotEventBase e)
98 {
99 super.OnExit(e);
100 }
101
102 override void OnUpdate(float dt)
103 {
104 if (m_Entity)
105 {
106 botDebugPrint("[bot] + " + m_Owner + " att item=" + m_Entity + " bot=" + m_Owner);
107
108 if (m_Owner.GetInventory().CanAddAttachment(m_Entity))
109 {
110 m_Owner.PredictiveTakeEntityAsAttachment(m_Entity);
111
113 if (m_Entity.GetInventory().GetCurrentInventoryLocation(loc))
114 {
115 if (loc.GetType() == InventoryLocationType.ATTACHMENT)
116 m_Bot.ProcessEvent(new BotEventEntityAttached(m_Owner, m_Entity));
117 }
118 }
119 }
120 }
121};
122
EntityAI m_Entity
Definition ActionDebug.c:11
void botDebugPrint(string s)
Definition Bot.c:182
FSMTransition< BotStateBase, BotEventBase, BotActionBase, BotGuardBase > BotTransition
Definition BotFSM.c:7
InventoryLocationType
types of Inventory Location
enum ProcessDirectDamageFlags m_Owner
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
ref BotTestAttachAndDropCycle_Attaching m_Attaching
ref BotTestAttachAndDropCycle_Detaching m_Detaching
void BotTestAttachAndDropCycle(Bot bot=NULL, BotStateBase parent=NULL)
override void OnUpdate(float dt)
override void OnEntry(BotEventBase e)
override void OnAbort(BotEventBase e)
override void OnExit(BotEventBase e)
InventoryLocation.