DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл TrapTrigger.c

См. исходные тексты.

Структуры данных

class  TrapTrigger
 Trigger used by traps. Подробнее...
 

Функции

TrapTrigger Trigger OnEnterServerEvent (TriggerInsider insider)
 
void TrapTrigger ()
 
void SetParentObject (TrapBase obj)
 
bool CanAddObjectAsInsider (Object object)
 
void OnLeaveServerEvent (TriggerInsider insider)
 
void SetEnabled ()
 prevents insider adding in the wrong position, HOTFIX
 

Переменные

bool m_Enabled = false
 
TrapBase m_ParentObj
 

Функции

◆ CanAddObjectAsInsider()

bool CanAddObjectAsInsider ( Object object)
protected
93 {
94 super.OnEnterServerEvent(insider);
95 }
96 }
Definition EntityAI.c:95

◆ OnEnterServerEvent()

TrapTrigger Trigger OnEnterServerEvent ( TriggerInsider insider)
71 {
73
74 if (playerInsider)
75 {
76 // If the player is jogging / sprinting while standing with or without hands raised, tripwire will trigger
77 bool isErect = ( playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT || playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT || playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH );
78 bool isJogging = ( playerInsider.m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_RUN || playerInsider.m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT );
79 if (isJogging && isErect)
80 {
81 super.OnEnterServerEvent(insider);
82 return;
83 }
84
85 // Special handling of crouch sprint
86 if ( playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH && playerInsider.m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT )
87 {
88 super.OnEnterServerEvent(insider);
89 return;
90 }
91 }
92 else
93 {
94 super.OnEnterServerEvent(insider);
95 }
96 }
Definition PlayerBaseClient.c:2
Object GetObject()
Definition Trigger.c:28
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602

◆ OnLeaveServerEvent()

void OnLeaveServerEvent ( TriggerInsider insider)
protected
111 : Trigger
112{
113 bool m_Enabled = false;
115
116 #ifdef DEVELOPER
117 bool m_CanSendDbg = true;
118 #endif
119
120 void TrapTrigger()
121 {
122 int mask = GetEventMask();
123 mask &= ~EntityEvent.INIT;
124 SetEventMask(mask);
125 }
126
127 void SetParentObject( TrapBase obj )
128 {
129 if (GetGame().IsServer())
130 {
131 m_ParentObj = obj;
132 }
133 }
134
135 override protected bool CanAddObjectAsInsider(Object object)
136 {
137 return m_Enabled && object.IsInherited(EntityAI) && m_ParentObj && m_ParentObj.IsActive() && m_ParentObj.GetTrapTrigger() == this;
138 }
139
140 override protected void OnEnterServerEvent(TriggerInsider insider)
141 {
142 #ifdef DEVELOPER
143 m_CanSendDbg = false;
144 #endif
145
146 if (m_ParentObj && m_ParentObj.IsActive())
147 {
148 m_ParentObj.SnapOnObject(EntityAI.Cast(insider.GetObject()));
149 }
150 }
151
152 override protected void OnLeaveServerEvent(TriggerInsider insider)
153 {
154 if (m_ParentObj && m_ParentObj.IsActive())
155 {
156 m_ParentObj.RemoveFromObject(EntityAI.Cast(insider.GetObject()));
157 }
158 }
159
161 void SetEnabled()
162 {
163 m_Enabled = true;
164 }
165
166 #ifdef DEVELOPER
167 override void DebugSendDmgTrigger()
168 {
169 if ( m_CanSendDbg )
170 super.DebugSendDmgTrigger();
171 }
172
173 #endif
174}
175
176// Used for tripwire type traps, where we want to allow players to go through
178{
179 override protected void OnEnterServerEvent( TriggerInsider insider )
180 {
182
183 if (playerInsider)
184 {
185 // If the player is jogging / sprinting while standing with or without hands raised, tripwire will trigger
186 bool isErect = ( playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT || playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT || playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH );
187 bool isJogging = ( playerInsider.m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_RUN || playerInsider.m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT );
188 if (isJogging && isErect)
189 {
190 super.OnEnterServerEvent(insider);
191 return;
192 }
193
194 // Special handling of crouch sprint
195 if ( playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH && playerInsider.m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT )
196 {
197 super.OnEnterServerEvent(insider);
198 return;
199 }
200 }
201 else
202 {
203 super.OnEnterServerEvent(insider);
204 }
205 }
206}
override void OnEnterServerEvent(TriggerInsider insider)
Definition AreaDamageManager.c:107
void OnLeaveServerEvent(TriggerInsider insider)
Definition TrapTrigger.c:110
TrapBase m_ParentObj
Definition TrapTrigger.c:72
void SetParentObject(TrapBase obj)
Definition TrapTrigger.c:85
bool m_Enabled
Definition TrapTrigger.c:71
void TrapTrigger()
Definition TrapTrigger.c:78
void SetEnabled()
prevents insider adding in the wrong position, HOTFIX
Definition TrapTrigger.c:119
TrapTrigger Trigger OnEnterServerEvent(TriggerInsider insider)
Definition TrapTrigger.c:70
bool CanAddObjectAsInsider(Object object)
Definition TrapTrigger.c:93
Definition Building.c:6
Definition ObjectTyped.c:2
Definition Trap_Bear.c:2
Trigger used by traps.
Definition TrapTrigger.c:3
Scripted Trigger.
Definition Hologram.c:1571
The object which is in a trigger and its metadata.
Definition Trigger.c:3
proto native CGame GetGame()
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:45

◆ SetEnabled()

void SetEnabled ( )
protected

prevents insider adding in the wrong position, HOTFIX

120 : Trigger
121{
122 bool m_Enabled = false;
124
125 #ifdef DEVELOPER
126 bool m_CanSendDbg = true;
127 #endif
128
129 void TrapTrigger()
130 {
131 int mask = GetEventMask();
132 mask &= ~EntityEvent.INIT;
133 SetEventMask(mask);
134 }
135
136 void SetParentObject( TrapBase obj )
137 {
138 if (GetGame().IsServer())
139 {
140 m_ParentObj = obj;
141 }
142 }
143
144 override protected bool CanAddObjectAsInsider(Object object)
145 {
146 return m_Enabled && object.IsInherited(EntityAI) && m_ParentObj && m_ParentObj.IsActive() && m_ParentObj.GetTrapTrigger() == this;
147 }
148
149 override protected void OnEnterServerEvent(TriggerInsider insider)
150 {
151 #ifdef DEVELOPER
152 m_CanSendDbg = false;
153 #endif
154
155 if (m_ParentObj && m_ParentObj.IsActive())
156 {
157 m_ParentObj.SnapOnObject(EntityAI.Cast(insider.GetObject()));
158 }
159 }
160
161 override protected void OnLeaveServerEvent(TriggerInsider insider)
162 {
163 if (m_ParentObj && m_ParentObj.IsActive())
164 {
165 m_ParentObj.RemoveFromObject(EntityAI.Cast(insider.GetObject()));
166 }
167 }
168
170 void SetEnabled()
171 {
172 m_Enabled = true;
173 }
174
175 #ifdef DEVELOPER
176 override void DebugSendDmgTrigger()
177 {
178 if ( m_CanSendDbg )
179 super.DebugSendDmgTrigger();
180 }
181
182 #endif
183}
184
185// Used for tripwire type traps, where we want to allow players to go through
187{
188 override protected void OnEnterServerEvent( TriggerInsider insider )
189 {
191
192 if (playerInsider)
193 {
194 // If the player is jogging / sprinting while standing with or without hands raised, tripwire will trigger
195 bool isErect = ( playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT || playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT || playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH );
196 bool isJogging = ( playerInsider.m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_RUN || playerInsider.m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT );
197 if (isJogging && isErect)
198 {
199 super.OnEnterServerEvent(insider);
200 return;
201 }
202
203 // Special handling of crouch sprint
204 if ( playerInsider.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH && playerInsider.m_MovementState.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT )
205 {
206 super.OnEnterServerEvent(insider);
207 return;
208 }
209 }
210 else
211 {
212 super.OnEnterServerEvent(insider);
213 }
214 }
215}

Используется в EntityLightSource::CheckIfParentIsInCargo(), EntityLightSource::Destroy(), SpotLightBase::PerformVisibilityCheck() и EntityLightSource::ScriptedLightBase().

◆ SetParentObject()

void SetParentObject ( TrapBase obj)
87 {
88 super.OnEnterServerEvent(insider);
89 return;
90 }
91 }

◆ TrapTrigger()

void TrapTrigger ( )
80 {
81 super.OnEnterServerEvent(insider);
82 return;
83 }

Переменные

◆ m_Enabled

◆ m_ParentObj

TrapBase m_ParentObj