Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
triggerevents.c
Go to the documentation of this file.
4 {
5  protected ref ScriptInvoker m_OnEnterInvoker;
6  protected ref ScriptInvoker m_OnLeaveInvoker;
7 
8  ScriptInvoker GetOnEnterInvoker()
9  {
10  if ( !m_OnEnterInvoker )
11  m_OnEnterInvoker = new ScriptInvoker;
12  return m_OnEnterInvoker;
13  }
14 
15  ScriptInvoker GetOnLeaveInvoker()
16  {
17  if ( !m_OnLeaveInvoker )
18  m_OnLeaveInvoker = new ScriptInvoker;
19  return m_OnLeaveInvoker;
20  }
21 
25  protected void Enter(TriggerInsider insider)
27  {
28  #ifdef TRIGGER_DEBUG_BASIC
29  Debug.TriggerLog(GetDebugName(insider.GetObject()), "TriggerEvents", "", "Enter", GetDebugName(this));
30  #endif
31 
32  OnEnterBeginEvent(insider);
33 
34  if (m_OnEnterInvoker)
35  m_OnEnterInvoker.Invoke(insider);
36 
37  if ( GetGame().IsServer() )
38  OnEnterServerEvent(insider);
39  else
40  OnEnterClientEvent(insider);
41 
42  OnEnterEndEvent(insider);
43  }
44  protected void OnEnterBeginEvent(TriggerInsider insider) {}
45  protected void OnEnterServerEvent(TriggerInsider insider) {}
46  protected void OnEnterClientEvent(TriggerInsider insider) {}
47  protected void OnEnterEndEvent(TriggerInsider insider) {}
49 
53  protected void StayStart(int nrOfInsiders)
55  {
56  #ifdef TRIGGER_DEBUG_SPAM
57  Debug.TriggerLog(nrOfInsiders.ToString(), "TriggerEvents", "", "StayStart", GetDebugName(this));
58  #endif
59 
60  OnStayStartBeginEvent(nrOfInsiders);
61 
62  if ( GetGame().IsServer() )
63  OnStayStartServerEvent(nrOfInsiders);
64  else
65  OnStayStartClientEvent(nrOfInsiders);
66 
67  OnStayStartEndEvent(nrOfInsiders);
68  }
69  protected void OnStayStartBeginEvent(int nrOfInsiders) {}
70  protected void OnStayStartServerEvent(int nrOfInsiders) {}
71  protected void OnStayStartClientEvent(int nrOfInsiders) {}
72  protected void OnStayStartEndEvent(int nrOfInsiders) {}
74 
78  protected void Stay(TriggerInsider insider, float deltaTime)
80  {
81  #ifdef TRIGGER_DEBUG_SPAM
82  Debug.TriggerLog(GetDebugName(insider.GetObject()), "TriggerEvents", "", "Stay", GetDebugName(this));
83  #endif
84 
85  OnStayBeginEvent(insider, deltaTime);
86 
87  if ( GetGame().IsServer() )
88  OnStayServerEvent(insider, deltaTime);
89  else
90  OnStayClientEvent(insider, deltaTime);
91 
92  OnStayEndEvent(insider, deltaTime);
93  }
94  protected void OnStayBeginEvent(TriggerInsider insider, float deltaTime) {}
95  protected void OnStayServerEvent(TriggerInsider insider, float deltaTime) {}
96  protected void OnStayClientEvent(TriggerInsider insider, float deltaTime) {}
97  protected void OnStayEndEvent(TriggerInsider insider, float deltaTime) {}
99 
103  protected void StayFinish()
105  {
106  #ifdef TRIGGER_DEBUG_SPAM
107  Debug.TriggerLog("", "TriggerEvents", "", "StayFinish", GetDebugName(this));
108  #endif
109 
110  OnStayFinishBeginEvent();
111 
112  if ( GetGame().IsServer() )
113  OnStayFinishServerEvent();
114  else
115  OnStayFinishClientEvent();
116 
117  OnStayFinishEndEvent();
118  }
119  protected void OnStayFinishBeginEvent() {}
120  protected void OnStayFinishServerEvent() {}
121  protected void OnStayFinishClientEvent() {}
122  protected void OnStayFinishEndEvent() {}
124 
128  protected void Leave(TriggerInsider insider)
130  {
131  #ifdef TRIGGER_DEBUG_BASIC
132  Debug.TriggerLog(GetDebugName(insider.GetObject()), "TriggerEvents", "", "Leave", GetDebugName(this));
133  #endif
134 
135  OnLeaveBeginEvent(insider);
136 
137  if (m_OnLeaveInvoker)
138  m_OnLeaveInvoker.Invoke(insider);
139 
140  if ( GetGame() && GetGame().IsServer() )
141  OnLeaveServerEvent(insider);
142  else
143  OnLeaveClientEvent(insider);
144 
145  OnLeaveEndEvent(insider);
146  }
147  protected void OnLeaveBeginEvent(TriggerInsider insider) {}
148  protected void OnLeaveServerEvent(TriggerInsider insider) {}
149  protected void OnLeaveClientEvent(TriggerInsider insider) {}
150  protected void OnLeaveEndEvent(TriggerInsider insider) {}
152 }
GetGame
proto native CGame GetGame()
TriggerInsider
The object which is in a trigger and its metadata.
Definition: trigger.c:2
TriggerEvents
Definition: triggerevents.c:3
ScriptedEntity
Definition: triggercarrierbase.c:1
GetDebugName
override string GetDebugName()
Definition: dayzplayer.c:1126
Debug
Definition: debug.c:13
ScriptInvoker
ScriptInvoker Class provide list of callbacks usage:
Definition: tools.c:115