DayZ 1.24
Loading...
Searching...
No Matches
BotTestSwapInternal Class Reference
Inheritance diagram for BotTestSwapInternal:
[legend]
Collaboration diagram for BotTestSwapInternal:
[legend]

Private Member Functions

void BotTestSwapInternal (Bot bot=NULL, BotStateBase parent=NULL)
 
override void OnEntry (BotEventBase e)
 
override void OnUpdate (float dt)
 
- Private Member Functions inherited from BotStateBase
void BotTimedWait (Bot bot=NULL, BotStateBase parent=NULL, float timeout=3.0)
 
override void OnEntry (BotEventBase e)
 
override void OnExit (BotEventBase e)
 
override void OnUpdate (float dt)
 
void OnTimeout ()
 

Private Attributes

EntityAI m_Entity1
 
EntityAI m_Entity2
 
- Private Attributes inherited from BotStateBase
float m_Timeout = 3.0
 
bool m_Periodic = true
 

Detailed Description

Definition at line 5 of file Bot_Tests.c.

Constructor & Destructor Documentation

◆ BotTestSwapInternal()

void BotTestSwapInternal::BotTestSwapInternal ( Bot bot = NULL,
BotStateBase parent = NULL )
inlineprivate

Definition at line 10 of file Bot_Tests.c.

11 { }

Member Function Documentation

◆ OnEntry()

override void BotTestSwapInternal::OnEntry ( BotEventBase e)
inlineprivate

Definition at line 13 of file Bot_Tests.c.

14 {
15 super.OnEntry(e);
16 EntityAI j = m_Owner.GetInventory().CreateAttachment("Jeans_Blue");
17 m_Entity1 = j.GetInventory().CreateEntityInCargo("Rag");
18 EntityAI s = m_Owner.GetInventory().CreateInInventory("TacticalShirt_Grey");
19 m_Entity2 = s.GetInventory().CreateEntityInCargo("Roadflare");
20 }
PlayerBase m_Owner
Definition BotStates.c:12
EntityAI m_Entity2
Definition Bot_Tests.c:8
EntityAI m_Entity1
Definition Bot_Tests.c:7

References m_Entity1, m_Entity2, and BotStateBase::m_Owner.

◆ OnUpdate()

override void BotTestSwapInternal::OnUpdate ( float dt)
inlineprivate

Definition at line 22 of file Bot_Tests.c.

23 {
24 super.OnUpdate(dt);
25
26 if (m_Entity1 && m_Entity2)
27 {
28 if (m_Owner.GetInventory().CanSwapEntitiesEx(m_Entity1, m_Entity2))
29 {
30 botDebugPrint("[bot] + " + m_Owner + " -> swap item=" + m_Entity1 + " bot=" + m_Owner);
31 m_Owner.PredictiveSwapEntities(m_Entity1, m_Entity2);
32 }
33 else if (m_Owner.GetInventory().CanSwapEntitiesEx(m_Entity2, m_Entity1))
34 {
35 botDebugPrint("[bot] + " + m_Owner + " <- swap item=" + m_Entity2 + " bot=" + m_Owner);
36 m_Owner.PredictiveSwapEntities(m_Entity2, m_Entity1);
37 }
38 }
39 }
void botDebugPrint(string s)
Definition Bot.c:182

References botDebugPrint(), m_Entity1, m_Entity2, and BotStateBase::m_Owner.

Member Data Documentation

◆ m_Entity1

EntityAI BotTestSwapInternal::m_Entity1
private

Definition at line 7 of file Bot_Tests.c.

Referenced by OnEntry(), and OnUpdate().

◆ m_Entity2

EntityAI BotTestSwapInternal::m_Entity2
private

Definition at line 8 of file Bot_Tests.c.

Referenced by OnEntry(), and OnUpdate().


The documentation for this class was generated from the following file: