DayZ 1.24
Loading...
Searching...
No Matches
TrapTrigger Class Reference

Trigger used by traps. More...

Inheritance diagram for TrapTrigger:
[legend]
Collaboration diagram for TrapTrigger:
[legend]

Protected Member Functions

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

Private Member Functions

void TrapTrigger ()
 
void SetParentObject (TrapBase obj)
 
- Private Member Functions inherited from Trigger
override void OnEnter (Object obj)
 
override void OnLeave (Object obj)
 
void UpdateInsiders (int timeout)
 
void SetParentObject (Hologram projection)
 
void SetParentOwner (PlayerBase player)
 
void OnEnterBeginEvent (TriggerInsider insider)
 
void OnLeaveBeginEvent (TriggerInsider insider)
 
void OnEnter (Object obj)
 
void OnLeave (Object obj)
 
bool CanAddObjectAsInsider (Object object)
 Condition whether an Object can be added as TriggerInsider (checked before calling AddInsider)
 
bool ShouldRemoveInsider (TriggerInsider insider)
 Condition whether a TriggerInsider should still be updated or not (checked in update loop and before adding)
 
bool ShouldRemoveInsiderNoLeave (TriggerInsider insider)
 Condition whether a TriggerInsider should still be updated or not, skips OnLeaveEvent (checked in update loop and before adding)
 
TriggerInsider CreateInsider (Object obj)
 Used for easily overriding TriggerInsider creation without rewriting AddInsider.
 
void AddInsider (Object obj)
 Adding of new TriggerInsider.
 
void RemoveInsider (TriggerInsider insider, int index=-1)
 Removing of TriggerInsider.
 
void RemoveInsiderByObject (Object object)
 Removing of TriggerInsider through Object.
 
void UpdateInsiders (int timeout)
 Update the current TriggerInsider inside the Trigger, timeout paramter is deprecated.
 
override void OnRPC (PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
 

Private Attributes

bool m_Enabled = false
 
TrapBase m_ParentObj
 
- Private Attributes inherited from Trigger
int m_TriggerUpdateMs
 
Hologram m_ParentObj
 
PlayerBase m_Player
 

Detailed Description

Trigger used by traps.

Definition at line 2 of file TrapTrigger.c.

Constructor & Destructor Documentation

◆ TrapTrigger()

void TrapTrigger::TrapTrigger ( )
inlineprivate

Definition at line 11 of file TrapTrigger.c.

12 {
13 int mask = GetEventMask();
14 mask &= ~EntityEvent.INIT;
15 SetEventMask(mask);
16 }
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:44

Member Function Documentation

◆ CanAddObjectAsInsider()

bool TrapTrigger::CanAddObjectAsInsider ( Object object)
inlineprotected

Definition at line 24 of file TrapTrigger.c.

25 {
26 return m_Enabled && object.IsInherited(EntityAI) && m_ParentObj && m_ParentObj.IsActive() && m_ParentObj.GetTrapTrigger() == this;
27 }
TrapBase m_ParentObj
Definition TrapTrigger.c:5
bool m_Enabled
Definition TrapTrigger.c:4

References m_Enabled, and m_ParentObj.

◆ OnEnterServerEvent()

void TrapTrigger::OnEnterServerEvent ( TriggerInsider insider)
inlineprotected

Definition at line 29 of file TrapTrigger.c.

30 {
31#ifdef DEVELOPER
32 m_CanSendDbg = false;
33#endif
34
35 if (m_ParentObj && m_ParentObj.IsActive())
36 m_ParentObj.SnapOnObject(EntityAI.Cast(insider.GetObject()));
37 }
Object GetObject()
Definition Trigger.c:28

References TriggerInsider::GetObject(), and m_ParentObj.

◆ OnLeaveServerEvent()

void TrapTrigger::OnLeaveServerEvent ( TriggerInsider insider)
inlineprotected

Definition at line 39 of file TrapTrigger.c.

40 {
41 if (m_ParentObj && m_ParentObj.IsActive())
42 m_ParentObj.RemoveFromObject(EntityAI.Cast(insider.GetObject()));
43 }

References TriggerInsider::GetObject(), and m_ParentObj.

◆ SetEnabled()

void TrapTrigger::SetEnabled ( )
inlineprotected

prevents insider adding in the wrong position, HOTFIX

Definition at line 46 of file TrapTrigger.c.

47 {
48 m_Enabled = true;
49 }

References m_Enabled.

Referenced by DeferredEnableTrigger().

◆ SetParentObject()

void TrapTrigger::SetParentObject ( TrapBase obj)
inlineprivate

Definition at line 18 of file TrapTrigger.c.

19 {
20 if (GetGame().IsServer())
21 m_ParentObj = obj;
22 }
proto native CGame GetGame()

References GetGame(), and m_ParentObj.

Referenced by CreateTrigger(), TrapBase::CreateTrigger(), and DeleteTrigger().

Member Data Documentation

◆ m_Enabled

bool TrapTrigger::m_Enabled = false
private

Definition at line 4 of file TrapTrigger.c.

Referenced by CanAddObjectAsInsider(), and SetEnabled().

◆ m_ParentObj

TrapBase TrapTrigger::m_ParentObj
private

The documentation for this class was generated from the following file: