Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
botguards.c
Go to the documentation of this file.
1 
5 {
11  bool GuardCondition (BotEventBase e) { return true; }
12 };
13 
14 class 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 
29 class 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 
43 class 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 
58 class 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 
HandGuardBase
TODO(kumarjac): This guard is unused but it has a fault and doesn't conform with maximimal/minimal ch...
Definition: hand_guards.c:6
LogManager
Definition: debug.c:734
HandEventBase
Abstracted event, not to be used, only inherited.
Definition: hand_events.c:194
botDebugPrint
void botDebugPrint(string s)
Definition: bot.c:182
BotEventBase
represents event that triggers transition from state to state
Definition: botevents.c:4
hndDebugPrint
void hndDebugPrint(string s)
Definition: handfsm.c:1
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
BotGuardBase
represents guard on a transition from state to state
Definition: botguards.c:4
GuardCondition
class BulletHide extends WeaponStateBase GuardCondition
Definition: guards.c:582