DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Bot_TestAttachAndDropCycle.c
См. документацию.
1#ifdef ROBOCLIENT
2class BotEventEntityAttached : BotEventBase { };
3
4class BotEventEntityDetached : BotEventBase { };
5
6class BotTestAttachAndDropCycle extends BotStateBase
7{
9 ref BotTestAttachAndDropCycle_Detaching m_Detaching;
10 ref BotTestAttachAndDropCycle_Attaching m_Attaching;
11
12 void BotTestAttachAndDropCycle (Bot bot = NULL, BotStateBase parent = NULL)
13 {
14 // setup nested state machine
15 m_FSM = new BotFSM(this); // @NOTE: set owner of the submachine fsm
16
17 m_Detaching = new BotTestAttachAndDropCycle_Detaching(m_Bot, this);
18 m_Attaching = new BotTestAttachAndDropCycle_Attaching(m_Bot, this);
19
20 // events
21 BotEventBase __EntAtt__ = new BotEventEntityAttached;
22 BotEventBase __EntDet__ = new BotEventEntityDetached;
23
24 // transitions
25 m_FSM.AddTransition(new BotTransition( m_Detaching, __EntDet__, m_Attaching));
26 m_FSM.AddTransition(new BotTransition( m_Attaching, __EntAtt__, m_Detaching));
27
28 m_FSM.SetInitialState(m_Detaching);
29 }
30
31 override void OnEntry (BotEventBase e)
32 {
33 m_Entity = m_Owner.GetInventory().CreateAttachment("TaloonBag_Orange");
34 m_Detaching.m_Entity = m_Entity;
35 m_Attaching.m_Entity = m_Entity;
36
37 super.OnEntry(e);
38 }
39
40 override void OnExit (BotEventBase e)
41 {
42 m_Entity = null;
43
44 super.OnExit(e);
45 }
46
47 override void OnUpdate (float dt)
48 {
49 super.OnUpdate(dt);
50 }
51};
52
53class BotTestAttachAndDropCycle_Detaching extends BotStateBase
54{
56
57 override void OnEntry (BotEventBase e)
58 {
59 super.OnEntry(e);
60 }
61
62 override void OnAbort (BotEventBase e) { super.OnAbort(e); }
63
64 override void OnExit (BotEventBase e)
65 {
66 super.OnExit(e);
67 }
68
69 override void OnUpdate (float dt)
70 {
71 if (m_Entity)
72 {
73 botDebugPrint("[bot] + " + m_Owner + " drop item=" + m_Entity + " bot=" + m_Owner);
74
75 m_Owner.PredictiveDropEntity(m_Entity);
76
77 InventoryLocation loc = new InventoryLocation;
79 {
80 if (loc.GetType() == InventoryLocationType.GROUND)
81 {
82 m_Bot.ProcessEvent(new BotEventEntityDetached(m_Owner, m_Entity));
83 }
84 }
85 }
86 }
87};
88
89class BotTestAttachAndDropCycle_Attaching extends BotStateBase
90{
92
93 override void OnEntry (BotEventBase e)
94 {
95 super.OnEntry(e);
96 }
97
98 override void OnAbort (BotEventBase e) { super.OnAbort(e); }
99
100 override void OnExit (BotEventBase e)
101 {
102 super.OnExit(e);
103 }
104
105 override void OnUpdate (float dt)
106 {
107 if (m_Entity)
108 {
109 botDebugPrint("[bot] + " + m_Owner + " att item=" + m_Entity + " bot=" + m_Owner);
110
111 if (m_Owner.GetInventory().CanAddAttachment(m_Entity))
112 {
113 m_Owner.PredictiveTakeEntityToTargetAttachment(m_Owner, m_Entity);
114
115 InventoryLocation loc = new InventoryLocation;
117 {
118 if (loc.GetType() == InventoryLocationType.ATTACHMENT)
119 {
120 m_Bot.ProcessEvent(new BotEventEntityAttached(m_Owner, m_Entity));
121 }
122 }
123 }
124 }
125 }
126};
127#endif
class LogManager EntityAI
Entity m_Entity
Определения CachedEquipmentStorageBase.c:16
HandStateEquipped OnEntry
Определения WeaponChambering.c:292
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
enum ProcessDirectDamageFlags m_Owner
override void OnAbort()
Определения RemoteDetonator.c:300
class WeaponChambering_Chamber_OnEntry extends WeaponChambering_Base OnExit
Определения WeaponChambering.c:352
proto native GameInventory GetInventory()
proto native EntityAI CreateAttachment(string typeName)
Create Entity of specified type as attachment of entity.
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
override void OnEntry(HandEventBase e)
Определения Hand_States.c:34
proto native int GetType()
returns type of InventoryLocation
override void OnExit(WeaponEventBase e)
Определения WeaponChambering.c:439
proto native void OnUpdate()
Определения 3_Game/DayZ/tools/tools.c:349