Dayz Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Loading...
Searching...
No Matches
geysertrigger.c
Go to the documentation of this file.
2{
3 const float MOUTH_ADJUST_RADIUS = 0.2; // maxium radius geyser effect can move when using randomized position adjustment
4 const string SOUND_BUBBLING = "Geyser_bubbling_loop_SoundSet";
5 const string SOUND_ERUPTION = "Geyser_eruption_loop_SoundSet";
6 const string SOUND_ERUPTION_START = "Geyser_eruption_start_SoundSet";
7 const string SOUND_ERUPTION_TALL = "Geyser_eruption_tall_loop_SoundSet";
8 const string SOUND_ERUPTION_TALL_START = "Geyser_eruption_tall_start_SoundSet";
9 const string SOUND_ERUPTION_TALL_END = "Geyser_eruption_tall_splash_SoundSet";
10
11 protected bool m_bIsDormant;
12 protected bool m_bIsEruptingSoon;
13 protected bool m_bIsErupting;
14 protected bool m_bIsEruptingTall;
15 protected float m_AdjustedX; //deprecated
16 protected float m_AdjustedY; //deprecated
18 protected EGeyserState m_GeyserState = EGeyserState.DORMANT; // synchronized state
19
30
32 {
33 RegisterNetSyncVariableInt("m_GeyserState", 0, 32);
34 }
35
36 override void DeferredInit()
37 {
38 super.DeferredInit();
39
41
42 if (IsSubmerged())
44
45 if (!g_Game.IsDedicatedServer())
47 }
48
49 override string GetDisplayName()
50 {
51 return "#STR_geyser";
52 }
53
54 override void EEDelete( EntityAI parent )
55 {
57
58 super.EEDelete(parent);
59 }
60
61 override void OnEnterServerEvent( TriggerInsider insider )
62 {
63 super.OnEnterServerEvent(insider);
64
65 if (insider && (m_GeyserState & EGeyserState.ERUPTING_PRIMARY))
66 {
67 EntityAI entity = EntityAI.Cast(insider.GetObject());
68 if (entity)
69 entity.ProcessDirectDamage(DamageType.CUSTOM, this, "", "HeatDamage", "0 0 0", 1000);
70 }
71 }
72
73 override void OnLeaveServerEvent( TriggerInsider insider )
74 {
75 super.OnLeaveServerEvent(insider);
76 }
77
78 override void OnEnterClientEvent( TriggerInsider insider )
79 {
80 super.OnEnterClientEvent(insider);
81 }
82
83 override void OnLeaveClientEvent( TriggerInsider insider )
84 {
85 super.OnLeaveClientEvent(insider);
86 }
87
89 {
90 super.OnVariablesSynchronized();
91
92 if (IsInitialized())
94 }
95
96 // Updated from OnVariablesSynchronized
97 protected void UpdateGeyserState()
98 {
99 // Debug.Log("UpdateGeyserState, state: " + m_GeyserState);
100
102 {
103 m_bIsDormant = true;
104 }
105 else if (!CheckGeyserState(EGeyserState.DORMANT) && m_bIsDormant)
106 {
107 m_bIsDormant = false;
108 }
109
110 if (CheckGeyserState(EGeyserState.ERUPTION_SOON) && !m_bIsEruptingSoon)
111 {
114
115 m_bIsEruptingSoon = true;
116 }
117 else if (!CheckGeyserState(EGeyserState.ERUPTION_SOON) && m_bIsEruptingSoon)
118 {
120 m_GeyserBubblesParticle.StopParticle();
121 if (m_SoundBubbling)
123
124 m_bIsEruptingSoon = false;
125 }
126
127 if (CheckGeyserState(EGeyserState.ERUPTING_PRIMARY) && !m_bIsErupting)
128 {
130
133
134 m_bIsErupting = true;
135 }
136 else if (!CheckGeyserState(EGeyserState.ERUPTING_PRIMARY) && m_bIsErupting)
137 {
139 m_GeyserParticle.StopParticle();
140
143 if (m_SoundEruption)
145
146 m_bIsErupting = false;
147 }
148
149 if (CheckGeyserState(EGeyserState.ERUPTING_SECONDARY) && !m_bIsEruptingTall)
150 {
152
155
156 m_bIsEruptingTall = true;
157 }
158 else if (!CheckGeyserState(EGeyserState.ERUPTING_SECONDARY) && m_bIsEruptingTall)
159 {
162
164 m_GeyserTallParticle.StopParticle();
169
170 m_bIsEruptingTall = false;
171 }
172 }
173
174 // Slightly adjust position of geyser particles
184
185 // Get position on surface of water volume or terrain, add height offset
186 protected vector GetAdjustedPosition(float height = 0)
187 {
188 vector pos = GetPosition();
189 pos[1] = g_Game.SurfaceRoadY(pos[0], pos[2], RoadSurfaceDetection.UNDER) + height;
190
191 return pos;
192 }
193
195 {
197 {
199 m_GeyserBubblesParticle.StopParticle();
200 if (m_SoundBubbling)
202 m_bIsEruptingSoon = false;
203 }
204
205 if (m_bIsErupting)
206 {
208 m_GeyserParticle.StopParticle();
209 if (m_SoundEruption)
211 m_bIsErupting = false;
212 }
213
215 {
217 m_GeyserTallParticle.StopParticle();
220 m_bIsEruptingTall = false;
221 }
222 }
223
225 {
226 m_GeyserState |= state;
227 SetSynchDirty();
228 }
229
231 {
232 m_GeyserState &= ~state;
233 SetSynchDirty();
234 }
235
237 {
238 if (state == EGeyserState.DORMANT)
239 return (m_GeyserState == state);
240 else
241 return (m_GeyserState & state);
242 }
243
245 {
246 return m_GeyserState;
247 }
248
249 // override for differences in logic between land & submerged geysers
251 {
252 return true;
253 }
254
255
256}
Wrapper class for managing sound through SEffectManager.
Definition effectsound.c:5
void EffectTrigger()
const float MOUTH_ADJUST_RADIUS
EGeyserState m_GeyserState
EGeyserState GetGeyserState()
const string SOUND_ERUPTION_TALL_END
override void DeferredInit()
EffectSound m_SoundEruptionSecondary
EffectSound m_SoundEruptionStart
const string SOUND_ERUPTION
bool CheckGeyserState(EGeyserState state)
void UpdateGeyserState()
ParticleSource m_GeyserTallParticle
override void OnLeaveClientEvent(TriggerInsider insider)
EffectSound m_SoundEruptionSecondaryStart
override void EEDelete(EntityAI parent)
ParticleSource m_GeyserSplashParticle
const string SOUND_ERUPTION_TALL_START
override string GetDisplayName()
vector m_DefaultPosition
const string SOUND_ERUPTION_START
void RandomizeMouthPos()
void RemoveGeyserState(EGeyserState state)
EffectSound m_SoundBubbling
void GeyserTrigger()
ParticleSource m_GeyserParticle
const string SOUND_BUBBLING
const string SOUND_ERUPTION_TALL
vector GetAdjustedPosition(float height=0)
EffectSound m_SoundEruptionSecondaryEnd
override void OnEnterServerEvent(TriggerInsider insider)
override void OnVariablesSynchronized()
ParticleSource m_GeyserBubblesParticle
EffectSound m_SoundEruption
override void OnLeaveServerEvent(TriggerInsider insider)
override void OnEnterClientEvent(TriggerInsider insider)
void AddGeyserState(EGeyserState state)
Definition enmath.c:7
static const int GEYSER_BUBBLES
static const int GEYSER_SPLASH
static const int GEYSER_STRONG
static const int GEYSER_NORMAL
Entity which has the particle instance as an ObjectComponent.
Manager class for managing Effect (EffectParticle, EffectSound).
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
The object which is in a trigger and its metadata.
Definition trigger.c:3
Object GetObject()
Definition trigger.c:28
override bool IsInitialized()
DamageType
exposed from C++ (do not change)
DayZGame g_Game
Definition dayzgame.c:3942
EGeyserState
Definition geyserarea.c:2
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
vector GetPosition()
Get the world position of the Effect.
Definition effect.c:473
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor).