Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
bot_testspamuseractions.c
Go to the documentation of this file.
1
2
class
BotTestSpamUserActions_Start
: BotTimedWait
3
{
4
override
void
OnEntry
(
BotEventBase
e)
5
{
6
super.OnEntry(e);
7
8
}
9
10
override
void
OnExit
(
BotEventBase
e)
11
{
12
botDebugPrint
(
"[bot] + "
+
m_Owner
+
"BotTestSpamUserActions_Start::OnExit"
);
13
14
/*if (g_Game.IsServer() && g_Game.IsMultiplayer())
15
{
16
botDebugPrint("[bot] + " + m_Owner + "BotTestSpamUserActions_Start spamming!");
17
for (int i = 0; i < 10000; ++i)
18
Print("Lovely SPAAAAAM!");
19
}*/
20
21
super.OnExit(e);
22
}
23
24
}
25
26
class
BotTestSpamUserActions_GetEntityFromSlot : BotTimedWait
27
{
28
EntityAI
m_Entity
= null;
29
bool
m_Run
=
false
;
30
int
m_RunStage
= 0;
31
ref
InventoryLocation
m_Src
=
new
InventoryLocation
;
32
33
override
void
OnEntry
(
BotEventBase
e)
34
{
35
m_Entity
=
m_Owner
.GetInventory().FindAttachment(
InventorySlots
.
GetSlotIdFromString
(
"Legs"
));
36
botDebugPrint
(
"[bot] + "
+
m_Owner
+
"BotTestSpamUserActions_GetEntityFromSlot item="
+
m_Entity
);
37
38
GameInventory
.
SetGroundPosByOwner
(
m_Owner
,
m_Entity
,
m_Src
);
39
/*if (!m_Entity.GetInventory().GetCurrentInventoryLocation(m_Src))
40
{
41
Error("NI!");
42
}*/
43
44
if
(!
g_Game
.IsDedicatedServer())
45
{
46
m_Entity
=
m_Owner
.GetInventory().FindAttachment(
InventorySlots
.
GetSlotIdFromString
(
"Legs"
));
47
m_Owner
.PredictiveDropEntity(
m_Entity
);
48
}
49
50
super.OnEntry(e);
51
}
52
53
override
void
OnExit
(
BotEventBase
e)
54
{
55
m_Entity
= null;
56
57
super.OnExit(e);
58
}
59
60
override
void
OnUpdate
(
float
dt)
61
{
62
super.OnUpdate(dt);
63
64
if
(!
g_Game
.IsDedicatedServer())
65
{
66
if
(
m_Run
&&
m_Entity
)
67
{
68
69
switch
(
m_RunStage
)
70
{
71
case
0:
72
botDebugPrint
(
"[bot] + "
+
m_Owner
+
" STS = "
+
m_Owner
.GetSimulationTimeStamp() +
" Stage="
+
m_RunStage
+
" item="
+
m_Entity
);
73
ScriptInputUserData
ctx =
new
ScriptInputUserData
;
74
HandEventTake e =
new
HandEventTake(
m_Owner
,
m_Src
);
75
InventoryInputUserData
.
SerializeHandEvent
(ctx, e);
76
ctx.
Send
();
77
break
;
78
79
case
1:
80
botDebugPrint
(
"[bot] + "
+
m_Owner
+
" STS = "
+
m_Owner
.GetSimulationTimeStamp() +
" Stage="
+
m_RunStage
+
" item="
+
m_Entity
);
81
ScriptInputUserData
ctx1 =
new
ScriptInputUserData
;
82
HandEventTake e1 =
new
HandEventTake(
m_Owner
,
m_Src
);
83
InventoryInputUserData
.
SerializeHandEvent
(ctx1, e1);
84
ctx1.
Send
();
85
break
;
86
87
case
5:
88
botDebugPrint
(
"[bot] + "
+
m_Owner
+
" STS = "
+
m_Owner
.GetSimulationTimeStamp() +
" Stage="
+
m_RunStage
+
" item="
+
m_Entity
);
89
ScriptInputUserData
ctx2 =
new
ScriptInputUserData
;
90
InventoryLocation
dst =
new
InventoryLocation
;
91
dst.
SetAttachment
(
m_Owner
,
m_Entity
,
InventorySlots
.
GetSlotIdFromString
(
"Legs"
));
92
InventoryInputUserData
.
SerializeMove
(ctx2,
InventoryCommandType
.SYNC_MOVE,
m_Src
, dst);
93
ctx2.
Send
();
94
break
;
95
96
case
10:
97
botDebugPrint
(
"[bot] + "
+
m_Owner
+
" STS = "
+
m_Owner
.GetSimulationTimeStamp() +
" Stage="
+
m_RunStage
+
" item="
+
m_Entity
);
98
ScriptInputUserData
ctx3 =
new
ScriptInputUserData
;
99
InventoryLocation
dst2 =
new
InventoryLocation
;
100
dst2.
SetAttachment
(
m_Owner
,
m_Entity
,
InventorySlots
.
GetSlotIdFromString
(
"Legs"
));
101
InventoryInputUserData
.
SerializeMove
(ctx3,
InventoryCommandType
.SYNC_MOVE,
m_Src
, dst2);
102
ctx3.
Send
();
103
break
;
104
105
/*
106
case 0:
107
botDebugPrint("[bot] + " + m_Owner + "Stage0 item=" + m_Entity);
108
m_Owner.PredictiveTakeEntityToHands(m_Entity);
109
break;
110
111
case 1:
112
botDebugPrint("[bot] + " + m_Owner + "Stage1 item=" + m_Entity);
113
m_Owner.PredictiveTakeEntityToHands(m_Entity);
114
break;
115
116
case 2:
117
botDebugPrint("[bot] + " + m_Owner + "Stage2 item=" + m_Entity);
118
m_Owner.PredictiveTakeEntityAsAttachmentEx(m_Entity, InventorySlots.GetSlotIdFromString("Legs"));
119
break;
120
121
case 3:
122
botDebugPrint("[bot] + " + m_Owner + "Stage3 item=" + m_Entity);
123
m_Owner.PredictiveTakeEntityAsAttachmentEx(m_Entity, InventorySlots.GetSlotIdFromString("Legs"));
124
break;*/
125
}
126
127
++
m_RunStage
;
128
}
129
}
130
}
131
132
override
void
OnTimeout
()
133
{
134
super.OnTimeout();
135
136
botDebugPrint
(
"[bot] + "
+
m_Owner
+
"BotTestSpamUserActions_GetEntityFromSlot item="
+
m_Entity
);
137
138
if
(
m_Entity
&&
m_Run
==
false
)
139
{
140
m_Run
=
true
;
141
m_RunStage
= 0;
142
}
143
}
144
}
145
146
147
class
BotTestSpamUserActions
:
BotStateBase
148
{
149
EntityAI
m_Entity
;
150
ref
BotTestSpamUserActions_Start
m_Start
;
151
ref BotTestSpamUserActions_GetEntityFromSlot
m_GetRef
;
152
//ref BotTimedWait m_Wait;
153
154
void
BotTestSpamUserActions
(
Bot
bot = NULL,
BotStateBase
parent = NULL)
155
{
156
// setup nested state machine
157
m_FSM
=
new
BotFSM
(
this
);
// @NOTE: set owner of the submachine fsm
158
159
m_Start
=
new
BotTestSpamUserActions_Start
(
m_Bot
,
this
, 1.0);
160
m_GetRef
=
new
BotTestSpamUserActions_GetEntityFromSlot(
m_Bot
,
this
, 2.0);
161
162
// events
163
BotEventBase
__EntWait__ =
new
BotEventWaitTimeout
;
164
165
// transitions
166
m_FSM
.AddTransition(
new
BotTransition
(
m_Start
, __EntWait__,
m_GetRef
));
167
168
m_FSM
.SetInitialState(
m_Start
);
169
}
170
171
override
void
OnEntry
(
BotEventBase
e)
172
{
173
m_Entity
= null;
174
175
if
(
g_Game
.IsServer())
176
{
177
m_Owner
.GetInventory().CreateAttachment(
"PolicePantsOrel"
);
// no assign to m_Entity
178
botDebugPrint
(
"[bot] + "
+
m_Owner
+
" created attachment item="
+
m_Entity
);
179
}
180
181
super.OnEntry(e);
182
}
183
184
override
void
OnExit
(
BotEventBase
e)
185
{
186
m_Entity
= null;
187
188
super.OnExit(e);
189
}
190
191
override
void
OnUpdate
(
float
dt)
192
{
193
super.OnUpdate(dt);
194
}
195
}
196
InventoryCommandType
InventoryCommandType
Definition
inventory.c:3
botDebugPrint
void botDebugPrint(string s)
Definition
bot.c:122
m_Run
bool m_Run
Definition
bot_testspamuseractions.c:29
OnTimeout
override void OnTimeout()
Definition
bot_testspamuseractions.c:132
m_RunStage
int m_RunStage
Definition
bot_testspamuseractions.c:30
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
BotEventWaitTimeout
Definition
bot_timedwait.c:2
BotFSM
Bot Finite State Machine (Hierarchical).
Bot
Definition
bot.c:19
BotStateBase::m_FSM
ref BotFSM m_FSM
hierarchical parent state of this state (or null)
Definition
botstates.c:15
BotStateBase::BotStateBase
void BotStateBase(Bot bot=NULL, BotStateBase parent=NULL)
nested state machine (or null)
Definition
botstates.c:17
BotStateBase::m_Owner
PlayerBase m_Owner
Definition
botstates.c:12
BotStateBase::m_Bot
Bot m_Bot
man that this state belongs to
Definition
botstates.c:13
BotTestSpamUserActions_Start
Definition
bot_testspamuseractions.c:3
BotTestSpamUserActions_Start::OnExit
override void OnExit(BotEventBase e)
Definition
bot_testspamuseractions.c:10
BotTestSpamUserActions_Start::OnEntry
override void OnEntry(BotEventBase e)
Definition
bot_testspamuseractions.c:4
BotTestSpamUserActions::m_Start
ref BotTestSpamUserActions_Start m_Start
Definition
bot_testspamuseractions.c:150
BotTestSpamUserActions::m_GetRef
ref BotTestSpamUserActions_GetEntityFromSlot m_GetRef
Definition
bot_testspamuseractions.c:151
BotTestSpamUserActions::OnExit
override void OnExit(BotEventBase e)
Definition
bot_testspamuseractions.c:184
BotTestSpamUserActions::OnEntry
override void OnEntry(BotEventBase e)
Definition
bot_testspamuseractions.c:171
BotTestSpamUserActions::OnUpdate
override void OnUpdate(float dt)
Definition
bot_testspamuseractions.c:191
BotTestSpamUserActions::BotTestSpamUserActions
void BotTestSpamUserActions(Bot bot=NULL, BotStateBase parent=NULL)
Definition
bot_testspamuseractions.c:154
BotTestSpamUserActions::m_Entity
EntityAI m_Entity
Definition
bot_testspamuseractions.c:149
EntityAI
Definition
inventoryitem.c:2
GameInventory
script counterpart to engine's class Inventory
Definition
inventory.c:81
GameInventory::SetGroundPosByOwner
static bool SetGroundPosByOwner(EntityAI owner, notnull EntityAI item, out InventoryLocation ground)
Definition
inventory.c:1257
InventoryInputUserData
Definition
inventoryinputuserdata.c:3
InventoryInputUserData::SerializeHandEvent
static void SerializeHandEvent(ParamsWriteContext ctx, HandEventBase e)
hand
Definition
inventoryinputuserdata.c:105
InventoryInputUserData::SerializeMove
static void SerializeMove(ParamsWriteContext ctx, int type, notnull InventoryLocation src, notnull InventoryLocation dst)
move
Definition
inventoryinputuserdata.c:5
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventoryLocation::SetAttachment
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
InventorySlots
provides access to slot configuration
Definition
inventoryslots.c:6
InventorySlots::GetSlotIdFromString
static proto native int GetSlotIdFromString(string slot_name)
ScriptInputUserData
Definition
gameplay.c:121
ScriptInputUserData::Send
proto native void Send()
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
OnUpdate
proto native void OnUpdate()
Definition
tools.c:349
m_Src
ref InventoryLocation m_Src
Definition
hand_events.c:43
OnEntry
HandStateEquipped OnEntry
Definition
weaponchambering.c:292
m_Owner
enum ProcessDirectDamageFlags m_Owner
OnExit
class WeaponChambering_Chamber_OnEntry extends WeaponChambering_Base OnExit
Definition
weaponchambering.c:352
Games
Dayz
scripts
4_world
systems
bot
bot_testspamuseractions.c
Generated by
1.17.0