DayZ 1.24
Loading...
Searching...
No Matches
Bot_TestSpamUserActions.c File Reference

Go to the source code of this file.

Classes

class  BotTestSpamUserActions_Start
 
class  BotTestSpamUserActions
 

Functions

override void OnEntry (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
override void OnTimeout ()
 

Variables

BotTestSpamUserActions_Start m_Entity = null
 
bool m_Run = false
 
int m_RunStage = 0
 
ref InventoryLocation m_Src = new InventoryLocation
 

Function Documentation

◆ OnEntry()

override void OnEntry ( BotEventBase e)

Definition at line 33 of file Bot_TestSpamUserActions.c.

34 {
35 m_Entity = m_Owner.GetInventory().FindAttachment(InventorySlots.GetSlotIdFromString("Legs"));
36 botDebugPrint("[bot] + " + m_Owner + "BotTestSpamUserActions_GetEntityFromSlot item=" + m_Entity);
37
39 /*if (!m_Entity.GetInventory().GetCurrentInventoryLocation(m_Src))
40 {
41 Error("NI!");
42 }*/
43
44 if (!GetGame().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 }
void botDebugPrint(string s)
Definition Bot.c:182
ref InventoryLocation m_Src
BotTestSpamUserActions_Start m_Entity
enum ProcessDirectDamageFlags m_Owner
script counterpart to engine's class Inventory
Definition Inventory.c:79
static bool SetGroundPosByOwner(EntityAI owner, notnull EntityAI item, out InventoryLocation ground)
Definition Inventory.c:1212
provides access to slot configuration
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
proto native CGame GetGame()

References botDebugPrint(), GetGame(), InventorySlots::GetSlotIdFromString(), m_Entity, m_Owner, m_Src, and GameInventory::SetGroundPosByOwner().

◆ OnExit()

override void OnExit ( BotEventBase e)

Definition at line 53 of file Bot_TestSpamUserActions.c.

54 {
55 m_Entity = null;
56
57 super.OnExit(e);
58 }

References m_Entity.

◆ OnTimeout()

override void OnTimeout ( )

Definition at line 132 of file Bot_TestSpamUserActions.c.

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 }

References botDebugPrint(), m_Entity, m_Owner, m_Run, and m_RunStage.

Referenced by BotStateBase::OnUpdate().

◆ OnUpdate()

override void OnUpdate ( float dt)

Definition at line 60 of file Bot_TestSpamUserActions.c.

61 {
62 super.OnUpdate(dt);
63
64 if (!GetGame().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);
74 HandEventTake e = new HandEventTake(m_Owner, m_Src);
76 ctx.Send();
77 break;
78
79 case 1:
80 botDebugPrint("[bot] + " + m_Owner + " STS = " + m_Owner.GetSimulationTimeStamp() + " Stage=" + m_RunStage + " item=" + m_Entity);
82 HandEventTake e1 = new HandEventTake(m_Owner, m_Src);
84 ctx1.Send();
85 break;
86
87 case 5:
88 botDebugPrint("[bot] + " + m_Owner + " STS = " + m_Owner.GetSimulationTimeStamp() + " Stage=" + m_RunStage + " item=" + m_Entity);
91 dst.SetAttachment(m_Owner, m_Entity, InventorySlots.GetSlotIdFromString("Legs"));
93 ctx2.Send();
94 break;
95
96 case 10:
97 botDebugPrint("[bot] + " + m_Owner + " STS = " + m_Owner.GetSimulationTimeStamp() + " Stage=" + m_RunStage + " item=" + m_Entity);
100 dst2.SetAttachment(m_Owner, m_Entity, InventorySlots.GetSlotIdFromString("Legs"));
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 }
InventoryCommandType
Definition Inventory.c:3
static void SerializeHandEvent(ParamsWriteContext ctx, HandEventBase e)
hand
static void SerializeMove(ParamsWriteContext ctx, int type, notnull InventoryLocation src, notnull InventoryLocation dst)
move
InventoryLocation.

References botDebugPrint(), GetGame(), InventorySlots::GetSlotIdFromString(), m_Entity, m_Owner, m_Run, m_RunStage, m_Src, InventoryInputUserData::SerializeHandEvent(), and InventoryInputUserData::SerializeMove().

Variable Documentation

◆ m_Entity

◆ m_Run

bool m_Run = false

Definition at line 29 of file Bot_TestSpamUserActions.c.

Referenced by OnTimeout(), and OnUpdate().

◆ m_RunStage

int m_RunStage = 0

Definition at line 30 of file Bot_TestSpamUserActions.c.

Referenced by OnTimeout(), and OnUpdate().

◆ m_Src