DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Bot_TestItemMoveBackAndForth.c
См. документацию.
1#ifdef ROBOCLIENT
2class BotTestItemMoveBackAndForth extends BotStateBase
3{
5 ref BotTestItemMoveBackAndForth_MoveFromSlotToSlot m_Move;
6
7 void BotTestItemMoveBackAndForth (Bot bot = NULL, BotStateBase parent = NULL)
8 {
9 // setup nested state machine
10 m_FSM = new BotFSM(this); // @NOTE: set owner of the submachine fsm
11
12 m_Move = new BotTestItemMoveBackAndForth_MoveFromSlotToSlot(m_Bot, this);
13
14 // events
15 BotEventBase __EntAtt__ = new BotEventEntityAttached;
16
17 // transitions
18 m_FSM.AddTransition(new BotTransition( m_Move, __EntAtt__, m_Move));
19
20 m_FSM.SetInitialState(m_Move);
21 }
22
23 override void OnEntry (BotEventBase e)
24 {
25 //m_Entity = m_Owner.GetInventory().CreateAttachment("TaloonBag_Orange");
26 //m_Entity = m_Owner.GetInventory().FindAttachment();
27 GameInventory ownerInventory = m_Owner.GetInventory();
28 EntityAI hgear = ownerInventory.FindAttachment( InventorySlots.GetSlotIdFromString("Headgear") );
29 EntityAI mask = ownerInventory.FindAttachment( InventorySlots.GetSlotIdFromString("Mask") );
30
31 if (hgear)
32 m_Entity = hgear;
33 if (mask)
34 m_Entity = mask;
35
36
37 InventoryLocation loc = new InventoryLocation;
39 {
40 m_Move.m_WaitingForSlot = loc.GetSlot();
41 }
42 else
43 Error("EE");
44 m_Move.m_Entity = m_Entity;
45
46 super.OnEntry(e);
47 }
48
49 override void OnExit (BotEventBase e)
50 {
51 m_Entity = null;
52
53 super.OnExit(e);
54 }
55
56 override void OnUpdate (float dt)
57 {
58 super.OnUpdate(dt);
59 }
60};
61
62class BotTestItemMoveBackAndForth_MoveFromSlotToSlot extends BotStateBase
63{
65 int m_WaitingForSlot = InventorySlots.INVALID;
66 int m_hgSlot = InventorySlots.GetSlotIdFromString("Headgear");
67 int m_mskSlot = InventorySlots.GetSlotIdFromString("Mask");
68
69 override void OnEntry (BotEventBase e)
70 {
71 super.OnEntry(e);
72 }
73
74 override void OnAbort (BotEventBase e) { super.OnAbort(e); }
75
76 override void OnExit (BotEventBase e)
77 {
78 super.OnExit(e);
79 }
80
81 int GetNextSlot (int curr)
82 {
83 if (curr == m_hgSlot)
84 return m_mskSlot;
85 if (curr == m_mskSlot)
86 return m_hgSlot;
87 Error("EE2");
88 return InventorySlots.INVALID;
89 }
90
91 override void OnUpdate (float dt)
92 {
93 if (m_Entity)
94 {
95 botDebugPrint("[bot] + " + m_Owner + " move item=" + m_Entity);
96
97 InventoryLocation loc = new InventoryLocation;
99 {
100 if (loc.GetType() == InventoryLocationType.ATTACHMENT)
101 {
102 if (loc.GetSlot() == m_WaitingForSlot)
103 {
104 int nextSlot = GetNextSlot(m_WaitingForSlot);
105 botDebugPrint("[bot] + " + m_Owner + " will switch slot=" + nextSlot + " for item=" + m_Entity);
106
107 m_WaitingForSlot = nextSlot;
108
109 m_Owner.PredictiveTakeEntityToTargetAttachmentEx(m_Owner, m_Entity, nextSlot);
110 //m_Bot.ProcessEvent(new BotEventEntityDet(m_Owner, m_Entity));
111 }
112 }
113 }
114 }
115 }
116};
117#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 bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native EntityAI FindAttachment(int slot)
Returns attached entity in slot (you can use InventorySlots.GetSlotIdFromString(name) to get slot id)
override void OnEntry(HandEventBase e)
Определения Hand_States.c:34
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetType()
returns type of InventoryLocation
override void OnExit(WeaponEventBase e)
Определения WeaponChambering.c:439
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
proto native void OnUpdate()
Определения 3_Game/DayZ/tools/tools.c:349