Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
botguards.c
Go to the documentation of this file.
1
5{
11 bool GuardCondition (BotEventBase e) { return true; }
12};
13
14class BotGuardAnd extends BotGuardBase
15{
16 ref BotGuardBase m_arg0;
17 ref BotGuardBase m_arg1;
18
19 void BotGuardAnd (BotGuardBase arg0 = NULL, BotGuardBase arg1 = NULL) { m_arg0 = arg0; m_arg1 = arg1; }
20
21 override bool GuardCondition (BotEventBase e)
22 {
23 bool result = m_arg0.GuardCondition(e) && m_arg1.GuardCondition(e);
24 botDebugPrint("[botfsm] guard - " + m_arg0.Type() + " && " + m_arg1.Type() + " = " + result);
25 return result;
26 }
27};
28
29class BotGuardNot extends BotGuardBase
30{
31 ref BotGuardBase m_arg0;
32
33 void BotGuardNot (BotGuardBase arg0 = NULL) { m_arg0 = arg0; }
34
35 override bool GuardCondition (BotEventBase e)
36 {
37 bool result = !m_arg0.GuardCondition(e);
38 botDebugPrint("[botfsm] guard - ! " + m_arg0.Type() + " = " + result);
39 return result;
40 }
41};
42
43class BotGuardOr extends BotGuardBase
44{
45 ref BotGuardBase m_arg0;
46 ref BotGuardBase m_arg1;
47
48 void BotGuardOr (BotGuardBase arg0 = NULL, BotGuardBase arg1 = NULL) { m_arg0 = arg0; m_arg1 = arg1; }
49
50 override bool GuardCondition (BotEventBase e)
51 {
52 bool result = m_arg0.GuardCondition(e) || m_arg1.GuardCondition(e);
53 botDebugPrint("[botfsm] guard - " + m_arg0.Type() + " || " + m_arg1.Type() + " = " + result);
54 return result;
55 }
56};
57
58class BotGuardHasItemInHands extends HandGuardBase
59{
60 protected Man m_Player;
61 void BotGuardHasItemInHands (Man p = NULL) { m_Player = p; }
62
63 override bool GuardCondition (HandEventBase e)
64 {
65 if (m_Player.GetHumanInventory().GetEntityInHands())
66 {
67 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[botfsm] guard - has valid entity in hands");
68 return true;
69 }
70
71 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[botfsm] guard - no entity in hands");
72 return false;
73 }
74};
75
76
77class BotGuardDebugEventMatches extends BotGuardBase
78{
80
81 void BotGuardDebugEventMatches(BotEventStartDebug e = NULL) { m_Event = e; }
82
84 {
86 if (!Class.CastTo(other, e))
87 {
88 return false;
89 }
90
91 return other.m_Id == m_Event.m_Id;
92 }
93};
void botDebugPrint(string s)
Definition bot.c:122
represents event that triggers transition from state to state
Definition botevents.c:5
represents guard on a transition from state to state
Definition botguards.c:5
override bool GuardCondition(BotEventBase e)
Definition botguards.c:83
void BotGuardDebugEventMatches(BotEventStartDebug e=NULL)
Definition botguards.c:81
ref BotEventStartDebug m_Event
Definition botguards.c:79
Super root of all classes in Enforce script.
Definition enscript.c:11
Abstracted event, not to be used, only inherited.
TODO(kumarjac): This guard is unused but it has a fault and doesn't conform with maximimal/minimal ch...
Definition hand_guards.c:7
void BotGuardHasItemInHands(Man p=NULL)
Definition botguards.c:61
override bool GuardCondition(HandEventBase e)
Definition botguards.c:63
override bool GuardCondition(WeaponEventBase e)
Definition guards.c:101
DayZPlayer m_Player
Definition hand_events.c:42
void hndDebugPrint(string s)
Definition handfsm.c:1