DayZ 1.24
Loading...
Searching...
No Matches
AreaDamageTriggerBase Class Reference
Collaboration diagram for AreaDamageTriggerBase:
[legend]

Protected Member Functions

void AreaDamageTrigger ()
 
override void EOnTouch (IEntity other, int extra)
 
override void SetExtents (vector mins, vector maxs)
 
override void SetAreaDamageManager (AreaDamageManager adType)
 
void SetAreaDamageType (AreaDamageBase adType)
 
override void OnEnter (Object obj)
 
override void OnLeave (Object obj)
 
void UpdateInsiders (int timeout)
 

Protected Attributes

ref AreaDamageBase m_AreaDamageType
 
vector m_ExtentMin
 
vector m_ExtentMax
 
float m_InnerDistance
 
int m_TriggerUpdateMs
 

Private Member Functions

override void OnStayServerEvent (TriggerInsider insider, float deltaTime)
 

Detailed Description

Definition at line 1 of file AreaDamageTriggerDirect.c.

Member Function Documentation

◆ AreaDamageTrigger()

void AreaDamageTriggerBase::AreaDamageTrigger ( )
inlineprotected

Definition at line 15 of file AreaDamageTrigger.c.

16 {
17 // Backwards compat, revert the flags back to what they used to be
18 ClearEventMask(EntityEvent.ENTER | EntityEvent.LEAVE);
19 SetEventMask(EntityEvent.TOUCH);
20
22
26
28 }
ref AreaDamageBase m_AreaDamageType
static const vector Zero
Definition EnConvert.c:110
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:44

References m_ExtentMax, m_ExtentMin, and vector::Zero.

◆ EOnTouch()

override void AreaDamageTriggerBase::EOnTouch ( IEntity other,
int extra )
inlineprotected

Definition at line 31 of file AreaDamageTrigger.c.

32 {
33 Object obj;
34 if (Class.CastTo(obj, other))
35 AddInsider(obj);
36 }
void AddInsider(Object obj)
Adding of new TriggerInsider.
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References AddInsider(), and Class::CastTo().

◆ OnEnter()

override void AreaDamageTriggerBase::OnEnter ( Object obj)
inlineprotected

Definition at line 62 of file AreaDamageTrigger.c.

63 {
64 super.OnEnter(obj);
65
66 if (GetGame().IsServer() && m_AreaDamageType)
67 m_AreaDamageType.OnEnter(obj);
68 }
proto native CGame GetGame()

References GetGame().

◆ OnLeave()

override void AreaDamageTriggerBase::OnLeave ( Object obj)
inlineprotected

Definition at line 70 of file AreaDamageTrigger.c.

71 {
72 super.OnLeave(obj);
73
74 if (GetGame().IsServer() && m_AreaDamageType)
75 m_AreaDamageType.OnLeave(obj);
76 }

References GetGame().

Referenced by UpdateInsiders().

◆ OnStayServerEvent()

override void AreaDamageTriggerBase::OnStayServerEvent ( TriggerInsider insider,
float deltaTime )
inlineprivate

Definition at line 3 of file AreaDamageTriggerDirect.c.

4 {
5 super.OnStayServerEvent(insider, deltaTime);
6
8 m_AreaDamageManager.OnEvaluateDamage(insider, deltaTime);
9 }
AreaDamageTriggerInsider m_AreaDamageManager
Managed by AreaDamageManager and its derivatives.

References m_AreaDamageManager.

◆ SetAreaDamageManager()

override void AreaDamageTriggerBase::SetAreaDamageManager ( AreaDamageManager adType)
inlineprotected

Definition at line 48 of file AreaDamageTrigger.c.

49 {
50 super.SetAreaDamageManager(adType);
51
53 }

Referenced by CreateDamageTriggerEx().

◆ SetAreaDamageType()

void AreaDamageTriggerBase::SetAreaDamageType ( AreaDamageBase adType)
inlineprotected

Definition at line 55 of file AreaDamageTrigger.c.

56 {
57 super.SetAreaDamageManager(adType);
58
60 }

◆ SetExtents()

override void AreaDamageTriggerBase::SetExtents ( vector mins,
vector maxs )
inlineprotected

Definition at line 38 of file AreaDamageTrigger.c.

39 {
42
44
45 super.SetExtents(mins, maxs);
46 }
float GetRadius()
Definition RadialMenu.c:358

References GetRadius(), m_ExtentMax, and m_ExtentMin.

Referenced by CreateDamageTriggerEx(), and SetExtents().

◆ UpdateInsiders()

void AreaDamageTriggerBase::UpdateInsiders ( int timeout)
inlineprotected

DEBUG

Definition at line 78 of file AreaDamageTrigger.c.

79 {
80 if (GetGame().IsServer())
81 {
82 for (int n = 0; n < m_insiders.Count();)
83 {
84 TriggerInsider ins = m_insiders.Get(n);
85 if (ins.GetObject() == null)
86 {
87 //object has been deleted. Remove it
88 m_insiders.Remove(n);
89 continue;
90 }
91
92 Object insObj = ins.GetObject();
93 if (insObj && (!insObj.IsAlive() || vector.DistanceSq(insObj.GetPosition(), GetPosition()) > (m_InnerDistance * m_InnerDistance)))
94 {
95 int timeDiff = g_Game.GetTime() - ins.timeStamp;
96 if (timeDiff > 500)
97 {
98 //object left. Remove it
99 OnLeave(ins.GetObject());
100 m_insiders.Remove(n);
101
102 continue;
103 }
104 else
105 {
106 //Print("" + this + " :: " + insObj + " :: " + timeDiff);
107 }
108 }
109
110 ++n;
111 }
112
114#ifdef DEVELOPER
116#endif
117 }
118 }
DayZGame g_Game
Definition DayZGame.c:3528
class JsonUndergroundAreaTriggerData GetPosition
override void OnLeave(Object obj)
The object which is in a trigger and its metadata.
Definition Trigger.c:3
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.

References vector::DistanceSq(), g_Game, GetGame(), GetPosition, and OnLeave().

Member Data Documentation

◆ m_AreaDamageType

ref AreaDamageBase AreaDamageTriggerBase::m_AreaDamageType
protected

Definition at line 7 of file AreaDamageTrigger.c.

◆ m_ExtentMax

vector AreaDamageTriggerBase::m_ExtentMax
protected

Definition at line 10 of file AreaDamageTrigger.c.

◆ m_ExtentMin

vector AreaDamageTriggerBase::m_ExtentMin
protected

Definition at line 9 of file AreaDamageTrigger.c.

◆ m_InnerDistance

float AreaDamageTriggerBase::m_InnerDistance
protected

Definition at line 11 of file AreaDamageTrigger.c.

◆ m_TriggerUpdateMs

int AreaDamageTriggerBase::m_TriggerUpdateMs
protected

Definition at line 13 of file AreaDamageTrigger.c.


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