Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
bot_testattachanddropcycle.c
Go to the documentation of this file.
1
class
BotEventEntityAttached
:
BotEventBase
{ };
2
3
class
BotEventEntityDetached
:
BotEventBase
{ };
4
5
class
BotTestAttachAndDropCycle
extends
BotStateBase
6
{
7
EntityAI
m_Entity
;
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
52
class
BotTestAttachAndDropCycle_Detaching
extends
BotStateBase
53
{
54
EntityAI
m_Entity
;
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
76
InventoryLocation
loc =
new
InventoryLocation
;
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
88
class
BotTestAttachAndDropCycle_Attaching
extends
BotStateBase
89
{
90
EntityAI
m_Entity
;
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
114
InventoryLocation
loc =
new
InventoryLocation
;
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
EntityAI
class LogManager EntityAI
botDebugPrint
void botDebugPrint(string s)
Definition
bot.c:122
BotTransition
FSMTransition< BotStateBase, BotEventBase, BotActionBase, BotGuardBase > BotTransition
Definition
botfsm.c:7
m_Entity
Entity m_Entity
Definition
cachedequipmentstoragebase.c:14
BotEventBase
represents event that triggers transition from state to state
Definition
botevents.c:5
BotEventBase::BotEventBase
void BotEventBase(PlayerBase p=NULL, EntityAI e=NULL)
Definition
botevents.c:9
BotEventEntityAttached
Definition
bot_testattachanddropcycle.c:1
BotEventEntityDetached
Definition
bot_testattachanddropcycle.c:3
BotFSM
Bot Finite State Machine (Hierarchical).
Bot
Definition
bot.c:19
BotStateBase
represent weapon state base
Definition
bot_hunt.c:16
BotStateBase::m_FSM
ref BotFSM m_FSM
hierarchical parent state of this state (or null)
Definition
botstates.c:15
BotStateBase::OnAbort
override void OnAbort(BotEventBase e)
Definition
bot_testattachanddropcycle.c:61
BotStateBase::m_Attaching
ref BotTestAttachAndDropCycle_Attaching m_Attaching
Definition
bot_testattachanddropcycle.c:9
BotStateBase::BotStateBase
void BotStateBase(Bot bot=NULL, BotStateBase parent=NULL)
nested state machine (or null)
Definition
botstates.c:17
BotStateBase::m_Detaching
ref BotTestAttachAndDropCycle_Detaching m_Detaching
Definition
bot_testattachanddropcycle.c:8
BotStateBase::BotTestAttachAndDropCycle
void BotTestAttachAndDropCycle(Bot bot=NULL, BotStateBase parent=NULL)
Definition
bot_testattachanddropcycle.c:11
BotStateBase::OnExit
override void OnExit(BotEventBase e)
Definition
bot_testattachanddropcycle.c:39
BotStateBase::m_Owner
PlayerBase m_Owner
Definition
botstates.c:12
BotStateBase::OnEntry
override void OnEntry(BotEventBase e)
Definition
bot_testattachanddropcycle.c:30
BotStateBase::OnUpdate
override void OnUpdate(float dt)
Definition
bot_testattachanddropcycle.c:46
BotStateBase::m_Entity
EntityAI m_Entity
Definition
bot_testattachanddropcycle.c:7
BotStateBase::m_Bot
Bot m_Bot
man that this state belongs to
Definition
botstates.c:13
EntityAI
Definition
inventoryitem.c:2
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventoryLocation::GetType
proto native int GetType()
returns type of InventoryLocation
InventoryLocationType
InventoryLocationType
types of Inventory Location
Definition
inventorylocation.c:4
Games
Dayz
scripts
4_world
systems
bot
bot_testattachanddropcycle.c
Generated by
1.17.0