DayZ 1.24
Loading...
Searching...
No Matches
UndergroundTrigger.c
Go to the documentation of this file.
1
3class UndergroundTriggerCarrier extends UndergroundTriggerCarrierBase
4{
7
9 {
10 RegisterNetSyncVariableInt("m_TriggerIndex", -1, 255);
11 }
12
14 {
15 if (m_Trigger && !m_Trigger.IsSetForDeletion() && GetGame())
16 {
17 //RemoveChild(m_Trigger);
18 m_Trigger.Delete();
19 }
20 }
21
23 {
24 super.OnVariablesSynchronized();
25 if (!m_Trigger)
27 }
28
30 {
31 return UndergroundAreaLoader.m_JsonData && m_TriggerIndex != -1;
32 }
33
35 {
36 //Print("RequestDelayedTriggerSpawn() " + this);
37 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SpawnTrigger, 100);
38 }
39
41 {
42
43 if (!CanSpawnTrigger())
44 {
46 return;
47 }
48
49 if (UndergroundAreaLoader.m_JsonData.Triggers && UndergroundAreaLoader.m_JsonData.Triggers.IsValidIndex(m_TriggerIndex))
50 {
52 UndergroundTrigger trigger = UndergroundTrigger.Cast(GetGame().CreateObjectEx("UndergroundTrigger", GetPosition(), ECE_LOCAL));
53 if (trigger)
54 {
55#ifdef DIAG_DEVELOPER
56 trigger.m_Local = true;
57#endif
58 trigger.SetPosition(vector.Zero);
59 AddChild(trigger, -1);
60 trigger.Init(data);
61
62 m_Trigger = trigger;
63 }
64 }
65 }
66
67}
68
70{
74 INNER
75}
76
78{
80
84
86 {
87 m_Data = data;
88 //Print("Spawning trigger " + this + "at pos: " + GetPosition());
89 vector extMax = data.GetSize() * 0.5;
92 m_Accommodation = data.EyeAccommodation;
93 m_InterpolationSpeed = data.InterpolationSpeed;
94
95 if (data.Breadcrumbs && data.Breadcrumbs.Count() > 0) //TODO: simpler check
96 {
97 if (data.Breadcrumbs.Count() > 32)
98 ErrorEx("max 'Breadcrumb' count is 32, found: " + data.Breadcrumbs.Count());
99 m_Type = EUndergroundTriggerType.TRANSITIONING;
100 }
101 else
102 {
103 if (m_Accommodation == 1)
105 else
107 }
108 }
109
110 override protected bool CanAddObjectAsInsider(Object object)
111 {
112 if (!super.CanAddObjectAsInsider(object))
113 return false;
114
115 PlayerBase player = PlayerBase.Cast(object);
116 return player.IsControlledPlayer();
117 }
118
119
120 override void EOnInit(IEntity other, int extra)
121 {
122 //disable parent behaviour
123 }
124
125
126#ifdef DEVELOPER
127 override protected void OnEnterServerEvent(TriggerInsider insider)
128 {
129#ifndef SERVER//to make it work in single during development
130 OnEnterClientEvent(insider);
131#endif
132 }
133 override protected void OnLeaveServerEvent(TriggerInsider insider)
134 {
135#ifndef SERVER//to make it work in single during development
136 OnLeaveClientEvent(insider);
137#endif
138 }
139#endif
140
141 override protected void OnEnterClientEvent(TriggerInsider insider)
142 {
143 //Print("OnEnterClientEvent " + this);
144 //return;
145 PlayerBase player = PlayerBase.Cast(insider.GetObject());
146 if (player)
147 {
148 UndergroundHandlerClient handler = player.GetUndergroundHandler();
149 if (handler)
150 handler.OnTriggerEnter(this);
151 }
152 }
153
154 override protected void OnLeaveClientEvent(TriggerInsider insider)
155 {
156 //Print("OnLeaveClientEvent " + this);
157 //return;
158 PlayerBase player = PlayerBase.Cast(insider.GetObject());
159 if (player)
160 {
161 UndergroundHandlerClient handler = player.GetUndergroundHandler();
162 if (handler)
163 handler.OnTriggerLeave(this);
164 }
165 }
166
167};
eBleedingSourceType m_Type
void SetExtents(vector mins, vector maxs)
override void OnLeaveClientEvent(TriggerInsider insider)
override void OnLeaveServerEvent(TriggerInsider insider)
override void OnEnterServerEvent(TriggerInsider insider)
override void OnEnterClientEvent(TriggerInsider insider)
const int ECE_LOCAL
override Widget Init()
Definition DayZGame.c:120
override void EOnInit(IEntity other, int extra)
bool CanAddObjectAsInsider(Object object)
Definition TrapTrigger.c:85
class JsonUndergroundAreaTriggerData GetPosition
void UndergroundHandlerClient(PlayerBase player)
class UndergroundTriggerCarrier extends UndergroundTriggerCarrierBase UNDEFINED
class UndergroundTriggerCarrier extends UndergroundTriggerCarrierBase OUTER
float m_Accommodation
class UndergroundTriggerCarrier extends UndergroundTriggerCarrierBase TRANSITIONING
float m_InterpolationSpeed
Trigger only accepting Object which IsMan()
Definition ManTrigger.c:3
The object which is in a trigger and its metadata.
Definition Trigger.c:3
Object GetObject()
Definition Trigger.c:28
static ref JsonUndergroundTriggers m_JsonData
ref JsonUndergroundAreaTriggerData m_Data
static const vector Zero
Definition EnConvert.c:110
proto native CGame GetGame()
enum ShapeType ErrorEx
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
proto native void AddChild(Widget child, bool immedUpdate=true)