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

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

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

class  FlareSimulation
 
class  FlareSimulation_Green
 

Функции

FlareSimulation Managed FlareSimulation_Red ()
 
void FlareSimulation ()
 
void OnActivation (Entity flare)
 
void OnTermination (Entity flare)
 
void OnFire (Entity flare)
 
void Simulate (Entity flare)
 
void FlareParticleUpdate ()
 
void CastFlareAINoise (vector position)
 
void TurnOffDistantLight ()
 
void ~FlareSimulation ()
 
FlareSimulation_Green FlareSimulation FlareSimulation_Blue ()
 
void FlareSimulation_Green ()
 

Переменные

Particle m_ParMainFire
 
EffectSound m_BurningSound
 
FlareLight m_FlareLight
 
static const float MAX_FARLIGHT_DIST = 40
 
static const float MIN_FARLIGHT_DIST = 5
 
static ref NoiseParams m_NoisePar
 
float m_LastNoiseTime = -1
 
float m_NoiseTimer = 0
 
const float NOISE_DELAY = 5
 
const float FLARE_SPIN_RATE = 1.15
 
const float FLARE_SPIN_RADIUS = 0.18
 
Entity m_Flare
 
vector m_RotationPoint
 
vector m_FlarePosition
 
float m_RotationDegrees
 
 m_ScriptedLight
 
int m_ParticleId
 

Функции

◆ CastFlareAINoise()

void CastFlareAINoise ( vector position)
protected

◆ FlareParticleUpdate()

void FlareParticleUpdate ( )
protected
255 : Managed
256{
257 protected Particle m_ParMainFire;
258 protected EffectSound m_BurningSound;
259 protected FlareLight m_FlareLight;
260 const static float MAX_FARLIGHT_DIST = 40;
261 const static float MIN_FARLIGHT_DIST = 5;
262
263 static ref NoiseParams m_NoisePar; // Contains the noise data ( template and strength )
264 float m_LastNoiseTime = -1;
265 float m_NoiseTimer = 0;
266 const float NOISE_DELAY = 5; // How much time between two consecutive noise pings
267
268 // flare effect rotation
269 protected const float FLARE_SPIN_RATE = 1.15; // in degrees per simul tick
270 protected const float FLARE_SPIN_RADIUS = 0.18; // radius of circling motion
271 protected Entity m_Flare;
272 protected vector m_RotationPoint;
273 protected vector m_FlarePosition;
274 protected float m_RotationDegrees;
275
276 static protected typename m_ScriptedLight;
277 static protected int m_ParticleId;
278
279 void FlareSimulation()
280 {
283 }
284
286 {
287 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() )
288 {
289 m_FlareLight = FlareLight.Cast( ScriptedLightBase.CreateLight( m_ScriptedLight, Vector(0,0,0) ) );
290 if ( m_FlareLight )
291 m_FlareLight.AttachOnObject( flare );
292
293 if (m_ParMainFire)
295
296 m_Flare = flare;
297 m_RotationPoint = m_Flare.GetOrigin();
299
300 m_ParMainFire = ParticleManager.GetInstance().PlayInWorld( m_ParticleId, m_FlarePosition );
301
302 flare.PlaySoundSetLoop( m_BurningSound, "roadflareLoop_SoundSet", 0, 0 );
303 }
304
305 if ( GetGame().IsServer() )
306 {
307 // Create and load noise parameters
308 m_NoisePar = new NoiseParams();
309 m_NoisePar.LoadFromPath("cfgWeapons Flaregun_Base NoiseFlare");
310 }
311 }
312
314 {
315 //MiscGameplayFunctions.GenerateAINoiseAtPosition(flare.GetPosition(), NOISE_DELAY, m_NoisePar);
316 }
317
318 void OnFire( Entity flare)
319 {
320 //m_ParMainFire = ParticleManager.GetInstance().PlayOnObject( ParticleList.FLAREPROJ_FIRE, flare);
321 //m_ParMainFire.SetWiggle( 7, 0.3);
322 }
323
324 void Simulate( Entity flare )
325 {
326 DayZPlayer player = GetGame().GetPlayer();
327 if ( player )
328 vector playerPos = player.GetPosition();
329
330 float dist = vector.DistanceSq(flare.GetPosition(), playerPos);
331
334
337
338 //CastFlareAINoise( flare.GetPosition() );
340 }
341
342 // Rotate flare particle and set its new position
343 protected void FlareParticleUpdate()
344 {
346 if (m_RotationDegrees > 360)
348
350 float sin = Math.Sin(angleRad);
351 float cos = Math.Cos(angleRad);
352
353 vector newFlarePos = m_ParMainFire.GetOrigin();
354 float surfacePos = GetGame().SurfaceY(newFlarePos[0], newFlarePos[2]);
355
356 if (newFlarePos[1] - surfacePos < 1) // reached ground
357 {
358 if (m_Flare.GetOrigin()[1] <= surfacePos) // actual flare pos might not match and height could be underground
360 else
361 m_ParMainFire.SetPosition(Vector(newFlarePos[0], m_Flare.GetOrigin()[1] ,newFlarePos[2]));
362
363 return;
364 }
365
366 // rotate vector around point
369
371 newFlarePos[1] = m_Flare.GetOrigin()[1];
373
374 m_ParMainFire.SetPosition(newFlarePos);
375
376 }
377
379 {
380 if ( m_LastNoiseTime < 0 )
381 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
382
383 float delta_time = GetGame().GetTime() * 0.0033 - m_LastNoiseTime;
384 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
385
387
388 if ( m_NoiseTimer >= NOISE_DELAY )
389 {
390 MiscGameplayFunctions.GenerateAINoiseAtPosition(position, NOISE_DELAY, m_NoisePar);
391
392 m_NoiseTimer = 0;
393 }
394 }
395
397 {
398 if (m_ParMainFire)
399 {
400 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME, 0);
401 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME_RND, 0);
404 }
405 }
406
407 void ~FlareSimulation()
408 {
409 if (m_ParMainFire)
411
412 if (m_BurningSound)
414
415 if (m_FlareLight)
416 m_FlareLight.FadeOut();
417 }
418}
419
421{
423 {
426 }
427}
428
430{
432 {
435 }
436}
437
439{
441 {
444 }
445}
void FlareLight()
Definition FlareLight.c:43
class FlareLightGreen extends FlareLight FlareLightBlue()
Definition FlareLight.c:56
class FlareLight extends PointLightBase FlareLightRed()
Definition FlareLight.c:38
void FlareLightGreen()
Definition FlareLight.c:57
static const float MIN_FARLIGHT_DIST
Definition FlareSimulation.c:173
void FlareParticleUpdate()
Definition FlareSimulation.c:255
void ~FlareSimulation()
Definition FlareSimulation.c:319
vector m_RotationPoint
Definition FlareSimulation.c:184
EffectSound m_BurningSound
Definition FlareSimulation.c:170
void TurnOffDistantLight()
Definition FlareSimulation.c:308
static ref NoiseParams m_NoisePar
Definition FlareSimulation.c:175
const float NOISE_DELAY
Definition FlareSimulation.c:178
const float FLARE_SPIN_RADIUS
Definition FlareSimulation.c:182
void FlareSimulation()
Definition FlareSimulation.c:191
void Simulate(Entity flare)
Definition FlareSimulation.c:236
vector m_FlarePosition
Definition FlareSimulation.c:185
void OnFire(Entity flare)
Definition FlareSimulation.c:230
float m_LastNoiseTime
Definition FlareSimulation.c:176
FlareSimulation_Green FlareSimulation FlareSimulation_Blue()
Definition FlareSimulation.c:186
float m_NoiseTimer
Definition FlareSimulation.c:177
FlareSimulation Managed FlareSimulation_Red()
Definition FlareSimulation.c:168
void CastFlareAINoise(vector position)
Definition FlareSimulation.c:290
FlareLight m_FlareLight
Definition FlareSimulation.c:171
void OnTermination(Entity flare)
Definition FlareSimulation.c:225
m_ScriptedLight
Definition FlareSimulation.c:188
const float FLARE_SPIN_RATE
Definition FlareSimulation.c:181
static const float MAX_FARLIGHT_DIST
Definition FlareSimulation.c:172
void OnActivation(Entity flare)
Definition FlareSimulation.c:197
int m_ParticleId
Definition FlareSimulation.c:189
float m_RotationDegrees
Definition FlareSimulation.c:186
Entity m_Flare
Definition FlareSimulation.c:183
Particle m_ParMainFire
Definition FlareSimulation.c:169
class NoiseSystem NoiseParams()
Definition Noise.c:15
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Definition ParticleManager.c:84
Definition DayZPlayerImplement.c:111
Wrapper class for managing sound through SEffectManager.
Definition EffectSound.c:5
void SoundStop()
Stops sound.
Definition EffectSound.c:217
Definition Camera.c:2
Definition FlareLight.c:46
Definition FlareSimulation.c:176
void FlareSimulation_Green()
Definition FlareSimulation.c:177
Definition FlareSimulation.c:2
m_ScriptedLight
Definition FlareSimulation.c:22
int m_ParticleId
Definition FlareSimulation.c:23
TODO doc.
Definition EnScript.c:118
Definition EnMath.c:7
Definition EntityAI.c:95
Legacy way of using particles in the game.
Definition Particle.c:7
void SetParameter(int emitter, int parameter, float value)
Set the value of a parameter of an emitor in the particle.
Definition Particle.c:625
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Definition Particle.c:266
Definition ParticleList.c:12
static const int FLAREPROJ_ACTIVATE_GREEN
Definition ParticleList.c:92
static const int FLAREPROJ_ACTIVATE_RED
Definition ParticleList.c:91
static const int FLAREPROJ_ACTIVATE_BLUE
Definition ParticleList.c:93
static const int FLAREPROJ_ACTIVATE
Definition ParticleList.c:90
Definition PointLightBase.c:2
Definition EnConvert.c:106
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
proto native CGame GetGame()
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static const float DEG2RAD
Definition EnMath.c:17
static proto float Sin(float angle)
Returns sinus of angle in radians.
EmitorParam
Definition EnVisual.c:114

◆ FlareSimulation()

void FlareSimulation ( )
protected

◆ FlareSimulation_Blue()

◆ FlareSimulation_Green()

void FlareSimulation_Green ( )

◆ FlareSimulation_Red()

◆ OnActivation()

void OnActivation ( Entity flare)
protected
197 : Managed
198{
199 protected Particle m_ParMainFire;
200 protected EffectSound m_BurningSound;
201 protected FlareLight m_FlareLight;
202 const static float MAX_FARLIGHT_DIST = 40;
203 const static float MIN_FARLIGHT_DIST = 5;
204
205 static ref NoiseParams m_NoisePar; // Contains the noise data ( template and strength )
206 float m_LastNoiseTime = -1;
207 float m_NoiseTimer = 0;
208 const float NOISE_DELAY = 5; // How much time between two consecutive noise pings
209
210 // flare effect rotation
211 protected const float FLARE_SPIN_RATE = 1.15; // in degrees per simul tick
212 protected const float FLARE_SPIN_RADIUS = 0.18; // radius of circling motion
213 protected Entity m_Flare;
214 protected vector m_RotationPoint;
215 protected vector m_FlarePosition;
216 protected float m_RotationDegrees;
217
218 static protected typename m_ScriptedLight;
219 static protected int m_ParticleId;
220
221 void FlareSimulation()
222 {
225 }
226
228 {
229 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() )
230 {
231 m_FlareLight = FlareLight.Cast( ScriptedLightBase.CreateLight( m_ScriptedLight, Vector(0,0,0) ) );
232 if ( m_FlareLight )
233 m_FlareLight.AttachOnObject( flare );
234
235 if (m_ParMainFire)
237
238 m_Flare = flare;
239 m_RotationPoint = m_Flare.GetOrigin();
241
242 m_ParMainFire = ParticleManager.GetInstance().PlayInWorld( m_ParticleId, m_FlarePosition );
243
244 flare.PlaySoundSetLoop( m_BurningSound, "roadflareLoop_SoundSet", 0, 0 );
245 }
246
247 if ( GetGame().IsServer() )
248 {
249 // Create and load noise parameters
250 m_NoisePar = new NoiseParams();
251 m_NoisePar.LoadFromPath("cfgWeapons Flaregun_Base NoiseFlare");
252 }
253 }
254
256 {
257 //MiscGameplayFunctions.GenerateAINoiseAtPosition(flare.GetPosition(), NOISE_DELAY, m_NoisePar);
258 }
259
260 void OnFire( Entity flare)
261 {
262 //m_ParMainFire = ParticleManager.GetInstance().PlayOnObject( ParticleList.FLAREPROJ_FIRE, flare);
263 //m_ParMainFire.SetWiggle( 7, 0.3);
264 }
265
266 void Simulate( Entity flare )
267 {
268 DayZPlayer player = GetGame().GetPlayer();
269 if ( player )
270 vector playerPos = player.GetPosition();
271
272 float dist = vector.DistanceSq(flare.GetPosition(), playerPos);
273
276
279
280 //CastFlareAINoise( flare.GetPosition() );
282 }
283
284 // Rotate flare particle and set its new position
285 protected void FlareParticleUpdate()
286 {
288 if (m_RotationDegrees > 360)
290
292 float sin = Math.Sin(angleRad);
293 float cos = Math.Cos(angleRad);
294
295 vector newFlarePos = m_ParMainFire.GetOrigin();
296 float surfacePos = GetGame().SurfaceY(newFlarePos[0], newFlarePos[2]);
297
298 if (newFlarePos[1] - surfacePos < 1) // reached ground
299 {
300 if (m_Flare.GetOrigin()[1] <= surfacePos) // actual flare pos might not match and height could be underground
302 else
303 m_ParMainFire.SetPosition(Vector(newFlarePos[0], m_Flare.GetOrigin()[1] ,newFlarePos[2]));
304
305 return;
306 }
307
308 // rotate vector around point
311
313 newFlarePos[1] = m_Flare.GetOrigin()[1];
315
316 m_ParMainFire.SetPosition(newFlarePos);
317
318 }
319
321 {
322 if ( m_LastNoiseTime < 0 )
323 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
324
325 float delta_time = GetGame().GetTime() * 0.0033 - m_LastNoiseTime;
326 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
327
329
330 if ( m_NoiseTimer >= NOISE_DELAY )
331 {
332 MiscGameplayFunctions.GenerateAINoiseAtPosition(position, NOISE_DELAY, m_NoisePar);
333
334 m_NoiseTimer = 0;
335 }
336 }
337
339 {
340 if (m_ParMainFire)
341 {
342 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME, 0);
343 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME_RND, 0);
346 }
347 }
348
349 void ~FlareSimulation()
350 {
351 if (m_ParMainFire)
353
354 if (m_BurningSound)
356
357 if (m_FlareLight)
358 m_FlareLight.FadeOut();
359 }
360}
361
363{
365 {
368 }
369}
370
372{
374 {
377 }
378}
379
381{
383 {
386 }
387}

◆ OnFire()

void OnFire ( Entity flare)
protected
230 : Managed
231{
232 protected Particle m_ParMainFire;
233 protected EffectSound m_BurningSound;
234 protected FlareLight m_FlareLight;
235 const static float MAX_FARLIGHT_DIST = 40;
236 const static float MIN_FARLIGHT_DIST = 5;
237
238 static ref NoiseParams m_NoisePar; // Contains the noise data ( template and strength )
239 float m_LastNoiseTime = -1;
240 float m_NoiseTimer = 0;
241 const float NOISE_DELAY = 5; // How much time between two consecutive noise pings
242
243 // flare effect rotation
244 protected const float FLARE_SPIN_RATE = 1.15; // in degrees per simul tick
245 protected const float FLARE_SPIN_RADIUS = 0.18; // radius of circling motion
246 protected Entity m_Flare;
247 protected vector m_RotationPoint;
248 protected vector m_FlarePosition;
249 protected float m_RotationDegrees;
250
251 static protected typename m_ScriptedLight;
252 static protected int m_ParticleId;
253
254 void FlareSimulation()
255 {
258 }
259
261 {
262 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() )
263 {
264 m_FlareLight = FlareLight.Cast( ScriptedLightBase.CreateLight( m_ScriptedLight, Vector(0,0,0) ) );
265 if ( m_FlareLight )
266 m_FlareLight.AttachOnObject( flare );
267
268 if (m_ParMainFire)
270
271 m_Flare = flare;
272 m_RotationPoint = m_Flare.GetOrigin();
274
275 m_ParMainFire = ParticleManager.GetInstance().PlayInWorld( m_ParticleId, m_FlarePosition );
276
277 flare.PlaySoundSetLoop( m_BurningSound, "roadflareLoop_SoundSet", 0, 0 );
278 }
279
280 if ( GetGame().IsServer() )
281 {
282 // Create and load noise parameters
283 m_NoisePar = new NoiseParams();
284 m_NoisePar.LoadFromPath("cfgWeapons Flaregun_Base NoiseFlare");
285 }
286 }
287
289 {
290 //MiscGameplayFunctions.GenerateAINoiseAtPosition(flare.GetPosition(), NOISE_DELAY, m_NoisePar);
291 }
292
293 void OnFire( Entity flare)
294 {
295 //m_ParMainFire = ParticleManager.GetInstance().PlayOnObject( ParticleList.FLAREPROJ_FIRE, flare);
296 //m_ParMainFire.SetWiggle( 7, 0.3);
297 }
298
299 void Simulate( Entity flare )
300 {
301 DayZPlayer player = GetGame().GetPlayer();
302 if ( player )
303 vector playerPos = player.GetPosition();
304
305 float dist = vector.DistanceSq(flare.GetPosition(), playerPos);
306
309
312
313 //CastFlareAINoise( flare.GetPosition() );
315 }
316
317 // Rotate flare particle and set its new position
318 protected void FlareParticleUpdate()
319 {
321 if (m_RotationDegrees > 360)
323
325 float sin = Math.Sin(angleRad);
326 float cos = Math.Cos(angleRad);
327
328 vector newFlarePos = m_ParMainFire.GetOrigin();
329 float surfacePos = GetGame().SurfaceY(newFlarePos[0], newFlarePos[2]);
330
331 if (newFlarePos[1] - surfacePos < 1) // reached ground
332 {
333 if (m_Flare.GetOrigin()[1] <= surfacePos) // actual flare pos might not match and height could be underground
335 else
336 m_ParMainFire.SetPosition(Vector(newFlarePos[0], m_Flare.GetOrigin()[1] ,newFlarePos[2]));
337
338 return;
339 }
340
341 // rotate vector around point
344
346 newFlarePos[1] = m_Flare.GetOrigin()[1];
348
349 m_ParMainFire.SetPosition(newFlarePos);
350
351 }
352
354 {
355 if ( m_LastNoiseTime < 0 )
356 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
357
358 float delta_time = GetGame().GetTime() * 0.0033 - m_LastNoiseTime;
359 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
360
362
363 if ( m_NoiseTimer >= NOISE_DELAY )
364 {
365 MiscGameplayFunctions.GenerateAINoiseAtPosition(position, NOISE_DELAY, m_NoisePar);
366
367 m_NoiseTimer = 0;
368 }
369 }
370
372 {
373 if (m_ParMainFire)
374 {
375 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME, 0);
376 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME_RND, 0);
379 }
380 }
381
382 void ~FlareSimulation()
383 {
384 if (m_ParMainFire)
386
387 if (m_BurningSound)
389
390 if (m_FlareLight)
391 m_FlareLight.FadeOut();
392 }
393}
394
396{
398 {
401 }
402}
403
405{
407 {
410 }
411}
412
414{
416 {
419 }
420}

◆ OnTermination()

void OnTermination ( Entity flare)
protected
225 : Managed
226{
227 protected Particle m_ParMainFire;
228 protected EffectSound m_BurningSound;
229 protected FlareLight m_FlareLight;
230 const static float MAX_FARLIGHT_DIST = 40;
231 const static float MIN_FARLIGHT_DIST = 5;
232
233 static ref NoiseParams m_NoisePar; // Contains the noise data ( template and strength )
234 float m_LastNoiseTime = -1;
235 float m_NoiseTimer = 0;
236 const float NOISE_DELAY = 5; // How much time between two consecutive noise pings
237
238 // flare effect rotation
239 protected const float FLARE_SPIN_RATE = 1.15; // in degrees per simul tick
240 protected const float FLARE_SPIN_RADIUS = 0.18; // radius of circling motion
241 protected Entity m_Flare;
242 protected vector m_RotationPoint;
243 protected vector m_FlarePosition;
244 protected float m_RotationDegrees;
245
246 static protected typename m_ScriptedLight;
247 static protected int m_ParticleId;
248
249 void FlareSimulation()
250 {
253 }
254
256 {
257 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() )
258 {
259 m_FlareLight = FlareLight.Cast( ScriptedLightBase.CreateLight( m_ScriptedLight, Vector(0,0,0) ) );
260 if ( m_FlareLight )
261 m_FlareLight.AttachOnObject( flare );
262
263 if (m_ParMainFire)
265
266 m_Flare = flare;
267 m_RotationPoint = m_Flare.GetOrigin();
269
270 m_ParMainFire = ParticleManager.GetInstance().PlayInWorld( m_ParticleId, m_FlarePosition );
271
272 flare.PlaySoundSetLoop( m_BurningSound, "roadflareLoop_SoundSet", 0, 0 );
273 }
274
275 if ( GetGame().IsServer() )
276 {
277 // Create and load noise parameters
278 m_NoisePar = new NoiseParams();
279 m_NoisePar.LoadFromPath("cfgWeapons Flaregun_Base NoiseFlare");
280 }
281 }
282
284 {
285 //MiscGameplayFunctions.GenerateAINoiseAtPosition(flare.GetPosition(), NOISE_DELAY, m_NoisePar);
286 }
287
288 void OnFire( Entity flare)
289 {
290 //m_ParMainFire = ParticleManager.GetInstance().PlayOnObject( ParticleList.FLAREPROJ_FIRE, flare);
291 //m_ParMainFire.SetWiggle( 7, 0.3);
292 }
293
294 void Simulate( Entity flare )
295 {
296 DayZPlayer player = GetGame().GetPlayer();
297 if ( player )
298 vector playerPos = player.GetPosition();
299
300 float dist = vector.DistanceSq(flare.GetPosition(), playerPos);
301
304
307
308 //CastFlareAINoise( flare.GetPosition() );
310 }
311
312 // Rotate flare particle and set its new position
313 protected void FlareParticleUpdate()
314 {
316 if (m_RotationDegrees > 360)
318
320 float sin = Math.Sin(angleRad);
321 float cos = Math.Cos(angleRad);
322
323 vector newFlarePos = m_ParMainFire.GetOrigin();
324 float surfacePos = GetGame().SurfaceY(newFlarePos[0], newFlarePos[2]);
325
326 if (newFlarePos[1] - surfacePos < 1) // reached ground
327 {
328 if (m_Flare.GetOrigin()[1] <= surfacePos) // actual flare pos might not match and height could be underground
330 else
331 m_ParMainFire.SetPosition(Vector(newFlarePos[0], m_Flare.GetOrigin()[1] ,newFlarePos[2]));
332
333 return;
334 }
335
336 // rotate vector around point
339
341 newFlarePos[1] = m_Flare.GetOrigin()[1];
343
344 m_ParMainFire.SetPosition(newFlarePos);
345
346 }
347
349 {
350 if ( m_LastNoiseTime < 0 )
351 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
352
353 float delta_time = GetGame().GetTime() * 0.0033 - m_LastNoiseTime;
354 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
355
357
358 if ( m_NoiseTimer >= NOISE_DELAY )
359 {
360 MiscGameplayFunctions.GenerateAINoiseAtPosition(position, NOISE_DELAY, m_NoisePar);
361
362 m_NoiseTimer = 0;
363 }
364 }
365
367 {
368 if (m_ParMainFire)
369 {
370 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME, 0);
371 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME_RND, 0);
374 }
375 }
376
377 void ~FlareSimulation()
378 {
379 if (m_ParMainFire)
381
382 if (m_BurningSound)
384
385 if (m_FlareLight)
386 m_FlareLight.FadeOut();
387 }
388}
389
391{
393 {
396 }
397}
398
400{
402 {
405 }
406}
407
409{
411 {
414 }
415}

◆ Simulate()

void Simulate ( Entity flare)
protected
236 : Managed
237{
238 protected Particle m_ParMainFire;
239 protected EffectSound m_BurningSound;
240 protected FlareLight m_FlareLight;
241 const static float MAX_FARLIGHT_DIST = 40;
242 const static float MIN_FARLIGHT_DIST = 5;
243
244 static ref NoiseParams m_NoisePar; // Contains the noise data ( template and strength )
245 float m_LastNoiseTime = -1;
246 float m_NoiseTimer = 0;
247 const float NOISE_DELAY = 5; // How much time between two consecutive noise pings
248
249 // flare effect rotation
250 protected const float FLARE_SPIN_RATE = 1.15; // in degrees per simul tick
251 protected const float FLARE_SPIN_RADIUS = 0.18; // radius of circling motion
252 protected Entity m_Flare;
253 protected vector m_RotationPoint;
254 protected vector m_FlarePosition;
255 protected float m_RotationDegrees;
256
257 static protected typename m_ScriptedLight;
258 static protected int m_ParticleId;
259
260 void FlareSimulation()
261 {
264 }
265
267 {
268 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() )
269 {
270 m_FlareLight = FlareLight.Cast( ScriptedLightBase.CreateLight( m_ScriptedLight, Vector(0,0,0) ) );
271 if ( m_FlareLight )
272 m_FlareLight.AttachOnObject( flare );
273
274 if (m_ParMainFire)
276
277 m_Flare = flare;
278 m_RotationPoint = m_Flare.GetOrigin();
280
281 m_ParMainFire = ParticleManager.GetInstance().PlayInWorld( m_ParticleId, m_FlarePosition );
282
283 flare.PlaySoundSetLoop( m_BurningSound, "roadflareLoop_SoundSet", 0, 0 );
284 }
285
286 if ( GetGame().IsServer() )
287 {
288 // Create and load noise parameters
289 m_NoisePar = new NoiseParams();
290 m_NoisePar.LoadFromPath("cfgWeapons Flaregun_Base NoiseFlare");
291 }
292 }
293
295 {
296 //MiscGameplayFunctions.GenerateAINoiseAtPosition(flare.GetPosition(), NOISE_DELAY, m_NoisePar);
297 }
298
299 void OnFire( Entity flare)
300 {
301 //m_ParMainFire = ParticleManager.GetInstance().PlayOnObject( ParticleList.FLAREPROJ_FIRE, flare);
302 //m_ParMainFire.SetWiggle( 7, 0.3);
303 }
304
305 void Simulate( Entity flare )
306 {
307 DayZPlayer player = GetGame().GetPlayer();
308 if ( player )
309 vector playerPos = player.GetPosition();
310
311 float dist = vector.DistanceSq(flare.GetPosition(), playerPos);
312
315
318
319 //CastFlareAINoise( flare.GetPosition() );
321 }
322
323 // Rotate flare particle and set its new position
324 protected void FlareParticleUpdate()
325 {
327 if (m_RotationDegrees > 360)
329
331 float sin = Math.Sin(angleRad);
332 float cos = Math.Cos(angleRad);
333
334 vector newFlarePos = m_ParMainFire.GetOrigin();
335 float surfacePos = GetGame().SurfaceY(newFlarePos[0], newFlarePos[2]);
336
337 if (newFlarePos[1] - surfacePos < 1) // reached ground
338 {
339 if (m_Flare.GetOrigin()[1] <= surfacePos) // actual flare pos might not match and height could be underground
341 else
342 m_ParMainFire.SetPosition(Vector(newFlarePos[0], m_Flare.GetOrigin()[1] ,newFlarePos[2]));
343
344 return;
345 }
346
347 // rotate vector around point
350
352 newFlarePos[1] = m_Flare.GetOrigin()[1];
354
355 m_ParMainFire.SetPosition(newFlarePos);
356
357 }
358
360 {
361 if ( m_LastNoiseTime < 0 )
362 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
363
364 float delta_time = GetGame().GetTime() * 0.0033 - m_LastNoiseTime;
365 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
366
368
369 if ( m_NoiseTimer >= NOISE_DELAY )
370 {
371 MiscGameplayFunctions.GenerateAINoiseAtPosition(position, NOISE_DELAY, m_NoisePar);
372
373 m_NoiseTimer = 0;
374 }
375 }
376
378 {
379 if (m_ParMainFire)
380 {
381 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME, 0);
382 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME_RND, 0);
385 }
386 }
387
388 void ~FlareSimulation()
389 {
390 if (m_ParMainFire)
392
393 if (m_BurningSound)
395
396 if (m_FlareLight)
397 m_FlareLight.FadeOut();
398 }
399}
400
402{
404 {
407 }
408}
409
411{
413 {
416 }
417}
418
420{
422 {
425 }
426}

◆ TurnOffDistantLight()

void TurnOffDistantLight ( )
protected
308 : Managed
309{
310 protected Particle m_ParMainFire;
311 protected EffectSound m_BurningSound;
312 protected FlareLight m_FlareLight;
313 const static float MAX_FARLIGHT_DIST = 40;
314 const static float MIN_FARLIGHT_DIST = 5;
315
316 static ref NoiseParams m_NoisePar; // Contains the noise data ( template and strength )
317 float m_LastNoiseTime = -1;
318 float m_NoiseTimer = 0;
319 const float NOISE_DELAY = 5; // How much time between two consecutive noise pings
320
321 // flare effect rotation
322 protected const float FLARE_SPIN_RATE = 1.15; // in degrees per simul tick
323 protected const float FLARE_SPIN_RADIUS = 0.18; // radius of circling motion
324 protected Entity m_Flare;
325 protected vector m_RotationPoint;
326 protected vector m_FlarePosition;
327 protected float m_RotationDegrees;
328
329 static protected typename m_ScriptedLight;
330 static protected int m_ParticleId;
331
332 void FlareSimulation()
333 {
336 }
337
339 {
340 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() )
341 {
342 m_FlareLight = FlareLight.Cast( ScriptedLightBase.CreateLight( m_ScriptedLight, Vector(0,0,0) ) );
343 if ( m_FlareLight )
344 m_FlareLight.AttachOnObject( flare );
345
346 if (m_ParMainFire)
348
349 m_Flare = flare;
350 m_RotationPoint = m_Flare.GetOrigin();
352
353 m_ParMainFire = ParticleManager.GetInstance().PlayInWorld( m_ParticleId, m_FlarePosition );
354
355 flare.PlaySoundSetLoop( m_BurningSound, "roadflareLoop_SoundSet", 0, 0 );
356 }
357
358 if ( GetGame().IsServer() )
359 {
360 // Create and load noise parameters
361 m_NoisePar = new NoiseParams();
362 m_NoisePar.LoadFromPath("cfgWeapons Flaregun_Base NoiseFlare");
363 }
364 }
365
367 {
368 //MiscGameplayFunctions.GenerateAINoiseAtPosition(flare.GetPosition(), NOISE_DELAY, m_NoisePar);
369 }
370
371 void OnFire( Entity flare)
372 {
373 //m_ParMainFire = ParticleManager.GetInstance().PlayOnObject( ParticleList.FLAREPROJ_FIRE, flare);
374 //m_ParMainFire.SetWiggle( 7, 0.3);
375 }
376
377 void Simulate( Entity flare )
378 {
379 DayZPlayer player = GetGame().GetPlayer();
380 if ( player )
381 vector playerPos = player.GetPosition();
382
383 float dist = vector.DistanceSq(flare.GetPosition(), playerPos);
384
387
390
391 //CastFlareAINoise( flare.GetPosition() );
393 }
394
395 // Rotate flare particle and set its new position
396 protected void FlareParticleUpdate()
397 {
399 if (m_RotationDegrees > 360)
401
403 float sin = Math.Sin(angleRad);
404 float cos = Math.Cos(angleRad);
405
406 vector newFlarePos = m_ParMainFire.GetOrigin();
407 float surfacePos = GetGame().SurfaceY(newFlarePos[0], newFlarePos[2]);
408
409 if (newFlarePos[1] - surfacePos < 1) // reached ground
410 {
411 if (m_Flare.GetOrigin()[1] <= surfacePos) // actual flare pos might not match and height could be underground
413 else
414 m_ParMainFire.SetPosition(Vector(newFlarePos[0], m_Flare.GetOrigin()[1] ,newFlarePos[2]));
415
416 return;
417 }
418
419 // rotate vector around point
422
424 newFlarePos[1] = m_Flare.GetOrigin()[1];
426
427 m_ParMainFire.SetPosition(newFlarePos);
428
429 }
430
432 {
433 if ( m_LastNoiseTime < 0 )
434 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
435
436 float delta_time = GetGame().GetTime() * 0.0033 - m_LastNoiseTime;
437 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
438
440
441 if ( m_NoiseTimer >= NOISE_DELAY )
442 {
443 MiscGameplayFunctions.GenerateAINoiseAtPosition(position, NOISE_DELAY, m_NoisePar);
444
445 m_NoiseTimer = 0;
446 }
447 }
448
450 {
451 if (m_ParMainFire)
452 {
453 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME, 0);
454 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME_RND, 0);
457 }
458 }
459
460 void ~FlareSimulation()
461 {
462 if (m_ParMainFire)
464
465 if (m_BurningSound)
467
468 if (m_FlareLight)
469 m_FlareLight.FadeOut();
470 }
471}
472
474{
476 {
479 }
480}
481
483{
485 {
488 }
489}
490
492{
494 {
497 }
498}

◆ ~FlareSimulation()

void ~FlareSimulation ( )
protected
319 : Managed
320{
321 protected Particle m_ParMainFire;
322 protected EffectSound m_BurningSound;
323 protected FlareLight m_FlareLight;
324 const static float MAX_FARLIGHT_DIST = 40;
325 const static float MIN_FARLIGHT_DIST = 5;
326
327 static ref NoiseParams m_NoisePar; // Contains the noise data ( template and strength )
328 float m_LastNoiseTime = -1;
329 float m_NoiseTimer = 0;
330 const float NOISE_DELAY = 5; // How much time between two consecutive noise pings
331
332 // flare effect rotation
333 protected const float FLARE_SPIN_RATE = 1.15; // in degrees per simul tick
334 protected const float FLARE_SPIN_RADIUS = 0.18; // radius of circling motion
335 protected Entity m_Flare;
336 protected vector m_RotationPoint;
337 protected vector m_FlarePosition;
338 protected float m_RotationDegrees;
339
340 static protected typename m_ScriptedLight;
341 static protected int m_ParticleId;
342
343 void FlareSimulation()
344 {
347 }
348
350 {
351 if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() )
352 {
353 m_FlareLight = FlareLight.Cast( ScriptedLightBase.CreateLight( m_ScriptedLight, Vector(0,0,0) ) );
354 if ( m_FlareLight )
355 m_FlareLight.AttachOnObject( flare );
356
357 if (m_ParMainFire)
359
360 m_Flare = flare;
361 m_RotationPoint = m_Flare.GetOrigin();
363
364 m_ParMainFire = ParticleManager.GetInstance().PlayInWorld( m_ParticleId, m_FlarePosition );
365
366 flare.PlaySoundSetLoop( m_BurningSound, "roadflareLoop_SoundSet", 0, 0 );
367 }
368
369 if ( GetGame().IsServer() )
370 {
371 // Create and load noise parameters
372 m_NoisePar = new NoiseParams();
373 m_NoisePar.LoadFromPath("cfgWeapons Flaregun_Base NoiseFlare");
374 }
375 }
376
378 {
379 //MiscGameplayFunctions.GenerateAINoiseAtPosition(flare.GetPosition(), NOISE_DELAY, m_NoisePar);
380 }
381
382 void OnFire( Entity flare)
383 {
384 //m_ParMainFire = ParticleManager.GetInstance().PlayOnObject( ParticleList.FLAREPROJ_FIRE, flare);
385 //m_ParMainFire.SetWiggle( 7, 0.3);
386 }
387
388 void Simulate( Entity flare )
389 {
390 DayZPlayer player = GetGame().GetPlayer();
391 if ( player )
392 vector playerPos = player.GetPosition();
393
394 float dist = vector.DistanceSq(flare.GetPosition(), playerPos);
395
398
401
402 //CastFlareAINoise( flare.GetPosition() );
404 }
405
406 // Rotate flare particle and set its new position
407 protected void FlareParticleUpdate()
408 {
410 if (m_RotationDegrees > 360)
412
414 float sin = Math.Sin(angleRad);
415 float cos = Math.Cos(angleRad);
416
417 vector newFlarePos = m_ParMainFire.GetOrigin();
418 float surfacePos = GetGame().SurfaceY(newFlarePos[0], newFlarePos[2]);
419
420 if (newFlarePos[1] - surfacePos < 1) // reached ground
421 {
422 if (m_Flare.GetOrigin()[1] <= surfacePos) // actual flare pos might not match and height could be underground
424 else
425 m_ParMainFire.SetPosition(Vector(newFlarePos[0], m_Flare.GetOrigin()[1] ,newFlarePos[2]));
426
427 return;
428 }
429
430 // rotate vector around point
433
435 newFlarePos[1] = m_Flare.GetOrigin()[1];
437
438 m_ParMainFire.SetPosition(newFlarePos);
439
440 }
441
443 {
444 if ( m_LastNoiseTime < 0 )
445 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
446
447 float delta_time = GetGame().GetTime() * 0.0033 - m_LastNoiseTime;
448 m_LastNoiseTime = GetGame().GetTime() * 0.0033;
449
451
452 if ( m_NoiseTimer >= NOISE_DELAY )
453 {
454 MiscGameplayFunctions.GenerateAINoiseAtPosition(position, NOISE_DELAY, m_NoisePar);
455
456 m_NoiseTimer = 0;
457 }
458 }
459
461 {
462 if (m_ParMainFire)
463 {
464 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME, 0);
465 m_ParMainFire.SetParameter(0, EmitorParam.LIFETIME_RND, 0);
468 }
469 }
470
471 void ~FlareSimulation()
472 {
473 if (m_ParMainFire)
475
476 if (m_BurningSound)
478
479 if (m_FlareLight)
480 m_FlareLight.FadeOut();
481 }
482}
483
485{
487 {
490 }
491}
492
494{
496 {
499 }
500}
501
503{
505 {
508 }
509}

Переменные

◆ FLARE_SPIN_RADIUS

const float FLARE_SPIN_RADIUS = 0.18
protected

◆ FLARE_SPIN_RATE

const float FLARE_SPIN_RATE = 1.15
protected

◆ m_BurningSound

EffectSound m_BurningSound
protected

◆ m_Flare

Entity m_Flare
protected

◆ m_FlareLight

FlareLight m_FlareLight
protected

◆ m_FlarePosition

vector m_FlarePosition
protected

◆ m_LastNoiseTime

float m_LastNoiseTime = -1
protected

◆ m_NoisePar

ref NoiseParams m_NoisePar
staticprotected

◆ m_NoiseTimer

float m_NoiseTimer = 0
protected

◆ m_ParMainFire

Particle m_ParMainFire
protected

◆ m_ParticleId

int m_ParticleId
staticprotected

◆ m_RotationDegrees

float m_RotationDegrees
protected

◆ m_RotationPoint

vector m_RotationPoint
protected

◆ m_ScriptedLight

m_ScriptedLight
staticprotected

◆ MAX_FARLIGHT_DIST

const float MAX_FARLIGHT_DIST = 40
staticprotected

◆ MIN_FARLIGHT_DIST

const float MIN_FARLIGHT_DIST = 5
staticprotected

◆ NOISE_DELAY

const float NOISE_DELAY = 5
protected