DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
BotGuards.c
См. документацию.
1#ifdef ROBOCLIENT
5class BotGuardBase
6{
12 bool GuardCondition (BotEventBase e) { return true; }
13};
14
15class BotGuardAnd extends BotGuardBase
16{
17 ref BotGuardBase m_arg0;
18 ref BotGuardBase m_arg1;
19
20 void BotGuardAnd (BotGuardBase arg0 = NULL, BotGuardBase arg1 = NULL) { m_arg0 = arg0; m_arg1 = arg1; }
21
22 override bool GuardCondition (BotEventBase e)
23 {
24 bool result = m_arg0.GuardCondition(e) && m_arg1.GuardCondition(e);
25 botDebugPrint("[botfsm] guard - " + m_arg0.Type() + " && " + m_arg1.Type() + " = " + result);
26 return result;
27 }
28};
29
30class BotGuardNot extends BotGuardBase
31{
32 ref BotGuardBase m_arg0;
33
34 void BotGuardNot (BotGuardBase arg0 = NULL) { m_arg0 = arg0; }
35
36 override bool GuardCondition (BotEventBase e)
37 {
38 bool result = !m_arg0.GuardCondition(e);
39 botDebugPrint("[botfsm] guard - ! " + m_arg0.Type() + " = " + result);
40 return result;
41 }
42};
43
44class BotGuardOr extends BotGuardBase
45{
46 ref BotGuardBase m_arg0;
47 ref BotGuardBase m_arg1;
48
49 void BotGuardOr (BotGuardBase arg0 = NULL, BotGuardBase arg1 = NULL) { m_arg0 = arg0; m_arg1 = arg1; }
50
51 override bool GuardCondition (BotEventBase e)
52 {
53 bool result = m_arg0.GuardCondition(e) || m_arg1.GuardCondition(e);
54 botDebugPrint("[botfsm] guard - " + m_arg0.Type() + " || " + m_arg1.Type() + " = " + result);
55 return result;
56 }
57};
58
59class BotGuardHasItemInHands extends BotGuardBase
60{
61 protected Man m_Player;
62 void BotGuardHasItemInHands (Man p = NULL) { m_Player = p; }
63
64 override bool GuardCondition(BotEventBase e)
65 {
66 if (m_Player.GetEntityInHands())
67 {
68 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[botfsm] guard - has valid entity in hands");
69 return true;
70 }
71
72 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[botfsm] guard - no entity in hands");
73 return false;
74 }
75};
76
77
78class BotGuardDebugEventMatches extends BotGuardBase
79{
80 protected ref BotEventStartDebug m_Event;
81
82 void BotGuardDebugEventMatches(BotEventStartDebug e = NULL) { m_Event = e; }
83
84 override bool GuardCondition(BotEventBase e)
85 {
86 BotEventStartDebug other;
87 if (!Class.CastTo(other, e))
88 {
89 return false;
90 }
91
92 return other.m_Id == m_Event.m_Id;
93 }
94};
95#endif
override bool GuardCondition(WeaponEventBase e)
Определения Guards.c:101
DayZPlayer m_Player
Определения Hand_Events.c:42
void hndDebugPrint(string s)
Определения HandFSM.c:1