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

Protected Member Functions

bool UsesGlobalDeploy ()
 
override bool IsDeployable ()
 
override float GetDeployTime ()
 how long it takes to deploy this item in seconds
 
void SetupColorSequences ()
 
string GetColorSequence ()
 
void OnPlacementComplete (Man player, vector position="0 0 0", vector orientation="0 0 0")
 
float GetMaxAllowedWetness ()
 
float GetEventDelay ()
 
string GetFuseSoundSet ()
 
int GetMaxShots ()
 
float GetFuseDelay ()
 
string GetAmmoType ()
 
int GetDamageType ()
 
void OnStateChangedServer (EFireworksState currentState)
 
void OnStateChangedClient (EFireworksState currentState)
 
override void OnIgnitedThis (EntityAI fire_source)
 Executed on Server when some item ignited this one.
 
bool CanPutInCargo (EntityAI parent)
 
bool CanPutIntoHands (EntityAI parent)
 
void OnFuseIgnitedServer ()
 
void OnFuseIgnitedClient ()
 
void OnFiringStartServer ()
 
void OnFiringStartClient ()
 
void OnFiringStop ()
 
void RestartEventTimer ()
 Starts event timer.
 
bool IsIgnited ()
 
bool CanIgniteItem (EntityAI ignite_target=NULL)
 
void OnEventServer (int type)
 Called periodically but only after the entity gets ignited.
 
void OnIndexChangedClient ()
 
FireworksLauncherClientEventBase SpawnEvent ()
 
void OnVariablesSynchronized ()
 
void OnStoreSave (ParamsWriteContext ctx)
 
bool OnStoreLoad (ParamsReadContext ctx, int version)
 
override string GetDeploySoundset ()
 
override string GetLoopDeploySoundset ()
 

Private Member Functions

void FireworksLauncher ()
 
void ~FireworksLauncher ()
 

Private Attributes

int m_Index
 
int m_IndexPrev
 
int m_ColorSequenceIndex
 
ref Timer m_TimerFuse
 
ref array< ref FireworksLauncherClientEventBase > m_Events
 
EffectSound m_FuseSoundStart
 
EffectSound m_FuseSound
 
ParticleSource m_ParticleFuse
 
ParticleSource m_ParticleAfterBurnEnd
 
ref array< stringm_ColorSequence
 

Detailed Description

Definition at line 311 of file FireworksLauncher.c.

Constructor & Destructor Documentation

◆ FireworksLauncher()

void FireworksLauncher::FireworksLauncher ( )
inlineprivate

Definition at line 324 of file FireworksLauncher.c.

325 {
328 RegisterNetSyncVariableInt("m_State", 0, EnumTools.GetLastEnumValue(EFireworksState));
329 RegisterNetSyncVariableInt("m_Index", 0, GetMaxShots());
330 RegisterNetSyncVariableInt("m_RandomSeed", 0, 1023);
331 int lastIndex = m_ColorSequence.Count() - 1;
332 RegisterNetSyncVariableInt("m_ColorSequenceIndex", 0, lastIndex);
333 m_RandomSeed = Math.RandomInt(0, 1023);
335 }
EFireworksState
int m_RandomSeed
static int GetLastEnumValue(typename e)
Return amount of values in enum.
Definition EnConvert.c:644
ref array< string > m_ColorSequence
Definition EnMath.c:7
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54

References EnumTools::GetLastEnumValue(), GetMaxShots(), m_ColorSequence, m_ColorSequenceIndex, m_RandomSeed, Math::RandomInt(), Math::RandomIntInclusive(), and SetupColorSequences().

◆ ~FireworksLauncher()

void FireworksLauncher::~FireworksLauncher ( )
inlineprivate

Definition at line 337 of file FireworksLauncher.c.

338 {
341 }
EffectSound m_FuseSoundStart
Manager class for managing Effect (EffectParticle, EffectSound)
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.

References SEffectManager::DestroyEffect(), m_FuseSound, and m_FuseSoundStart.

Member Function Documentation

◆ CanIgniteItem()

bool FireworksLauncher::CanIgniteItem ( EntityAI ignite_target = NULL)
inlineprotected

Definition at line 559 of file FireworksLauncher.c.

560 {
561 return false;
562 }

◆ CanPutInCargo()

bool FireworksLauncher::CanPutInCargo ( EntityAI parent)
inlineprotected

Definition at line 482 of file FireworksLauncher.c.

483 {
484 return (GetState() == EFireworksState.DEFAULT || (GetState() == EFireworksState.PLACED) || (GetState() == EFireworksState.FINISHED);
485 }
proto native int GetState()
returns one of STATE_...

References GetState().

◆ CanPutIntoHands()

bool FireworksLauncher::CanPutIntoHands ( EntityAI parent)
inlineprotected

Definition at line 487 of file FireworksLauncher.c.

488 {
489 return (GetState() == EFireworksState.DEFAULT || (GetState() == EFireworksState.PLACED) || (GetState() == EFireworksState.FINISHED);
490 }

References GetState().

◆ GetAmmoType()

string FireworksLauncher::GetAmmoType ( )
inlineprotected

Definition at line 423 of file FireworksLauncher.c.

424 {
425 return "Fireworks_Ammo";
426 }

Referenced by OnEventServer(), and Anniversary_FireworksLauncher::OnEventServer().

◆ GetColorSequence()

string FireworksLauncher::GetColorSequence ( )
inlineprotected

Definition at line 375 of file FireworksLauncher.c.

376 {
377 if (m_ColorSequence.IsValidIndex(m_ColorSequenceIndex))
379 else
380 {
381 ErrorEx("Failed to obtain color sequence");
382 return "RYPBYYPBRGBYPBRGBRBGBPBRGRGBRBGRYPYR";
383 }
384 }
enum ShapeType ErrorEx

References ErrorEx, m_ColorSequence, and m_ColorSequenceIndex.

Referenced by FireworksLauncherClientEvent::FireworksLauncherClientEvent().

◆ GetDamageType()

int FireworksLauncher::GetDamageType ( )
inlineprotected

Definition at line 428 of file FireworksLauncher.c.

429 {
430 return DamageType.EXPLOSION;
431 }
DamageType
exposed from C++ (do not change)

Referenced by OnEventServer(), and Anniversary_FireworksLauncher::OnEventServer().

◆ GetDeploySoundset()

override string FireworksLauncher::GetDeploySoundset ( )
inlineprotected

Definition at line 638 of file FireworksLauncher.c.

639 {
640 return "placeFireworks_SoundSet";
641 }

◆ GetDeployTime()

override float FireworksLauncher::GetDeployTime ( )
inlineprotected

how long it takes to deploy this item in seconds

Definition at line 354 of file FireworksLauncher.c.

355 {
356 return 2;
357 }

◆ GetEventDelay()

float FireworksLauncher::GetEventDelay ( )
inlineprotected

Definition at line 403 of file FireworksLauncher.c.

404 {
405 return Math.RandomFloatInclusive(3, 3.35);
406 }
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106

References Math::RandomFloatInclusive().

Referenced by RestartEventTimer().

◆ GetFuseDelay()

float FireworksLauncher::GetFuseDelay ( )
inlineprotected

Definition at line 418 of file FireworksLauncher.c.

419 {
420 return 3;
421 }

Referenced by OnFuseIgnitedServer().

◆ GetFuseSoundSet()

string FireworksLauncher::GetFuseSoundSet ( )
inlineprotected

Definition at line 408 of file FireworksLauncher.c.

409 {
410 return "FireworksLauncher_Ignition_Loop_SoundSet";
411 }

Referenced by OnFuseIgnitedClient().

◆ GetLoopDeploySoundset()

override string FireworksLauncher::GetLoopDeploySoundset ( )
inlineprotected

Definition at line 643 of file FireworksLauncher.c.

644 {
645 return "fireworks_deploy_SoundSet";
646 }

◆ GetMaxAllowedWetness()

float FireworksLauncher::GetMaxAllowedWetness ( )
inlineprotected

Definition at line 397 of file FireworksLauncher.c.

398 {
400 }
const float STATE_WET
Definition constants.c:783

References GameConstants::STATE_WET.

◆ GetMaxShots()

int FireworksLauncher::GetMaxShots ( )
inlineprotected

Definition at line 413 of file FireworksLauncher.c.

414 {
415 return 16;
416 }

Referenced by FireworksLauncher(), and OnEventServer().

◆ IsDeployable()

override bool FireworksLauncher::IsDeployable ( )
inlineprotected

Definition at line 348 of file FireworksLauncher.c.

349 {
350 return true;
351 }

◆ IsIgnited()

bool FireworksLauncher::IsIgnited ( )
inlineprotected

Definition at line 554 of file FireworksLauncher.c.

555 {
556 return GetState() == EFireworksState.IGNITED;
557 }

References GetState().

◆ OnEventServer()

void FireworksLauncher::OnEventServer ( int type)
inlineprotected

Called periodically but only after the entity gets ignited.

Definition at line 566 of file FireworksLauncher.c.

567 {
568 m_Index++;
569 DamageSystem.ExplosionDamage(this, NULL, GetAmmoType(), GetPosition(), GetDamageType());
570
571 SetSynchDirty();
572 if (m_Index > GetMaxShots())
573 {
576 SetState(EFireworksState.FINISHED);
577 }
578 else
580 }
ref Timer m_TimerEvent
void SetState(bool state)
class JsonUndergroundAreaTriggerData GetPosition
void RestartEventTimer()
Starts event timer.

References GetAmmoType(), GetDamageType(), GetMaxShots(), GetPosition, m_Index, m_TimerEvent, RestartEventTimer(), and SetState().

Referenced by OnFiringStartServer().

◆ OnFiringStartClient()

void FireworksLauncher::OnFiringStartClient ( )
inlineprotected

Definition at line 532 of file FireworksLauncher.c.

533 {
534 if (m_ParticleFuse)
536 if (m_FuseSound)
538 }
override void Stop()
Stops sound.
ParticleSource m_ParticleFuse
override bool StopParticle(int flags=0)
Method to tell the particle to stop playing.

References m_FuseSound, m_ParticleFuse, EffectSound::Stop(), and ParticleSource::StopParticle().

Referenced by OnStateChangedClient().

◆ OnFiringStartServer()

void FireworksLauncher::OnFiringStartServer ( )
inlineprotected

Definition at line 527 of file FireworksLauncher.c.

528 {
529 OnEventServer(0);
530 }
void OnEventServer(int type)
Called periodically but only after the entity gets ignited.

References OnEventServer().

Referenced by OnStateChangedServer().

◆ OnFiringStop()

void FireworksLauncher::OnFiringStop ( )
inlineprotected

Definition at line 540 of file FireworksLauncher.c.

541 {
542 SetHealth01("", "", 0);
543 }

◆ OnFuseIgnitedClient()

void FireworksLauncher::OnFuseIgnitedClient ( )
inlineprotected

Definition at line 498 of file FireworksLauncher.c.

499 {
500 m_ParticleFuse = ParticleManager.GetInstance().PlayInWorld(ParticleList.FIREWORKS_FUSE, GetPosition() + "0 0.15 0");
501 if (m_ParticleFuse)
503 PlaySoundSet(m_FuseSoundStart, "FireworksLauncher_Ignition_Start_SoundSet", 0, 0);
506
507 if (MemoryPointExists("Fuse_Start"))
508 {
509 fuseStart = GetMemoryPointPos("Fuse_Start");
510 fuseStart = ModelToWorld(fuseStart);
511 }
512 if (MemoryPointExists("Fuse_End"))
513 {
514 fuseEnd = GetMemoryPointPos("Fuse_End");
515 fuseEnd = ModelToWorld(fuseEnd);
516 }
517
520 vector ori = fuseDir.VectorToAngles();
521 m_ParticleFuse.SetOrientation(ori);
522 m_ParticleFuse.SetPosition(fuseStart);
523
524 PlaySoundSetLoop(m_FuseSound, GetFuseSoundSet(), 0, 0);
525 }
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
static const int FIREWORKS_FUSE
proto native void SetOwner(Class owner)
Set the owner of this ParticleSource.

References ParticleList::FIREWORKS_FUSE, GetFuseSoundSet(), GetPosition, m_FuseSound, m_FuseSoundStart, m_ParticleFuse, ParticleManager(), and ParticleSource::SetOwner().

Referenced by OnStateChangedClient().

◆ OnFuseIgnitedServer()

void FireworksLauncher::OnFuseIgnitedServer ( )
inlineprotected

Definition at line 492 of file FireworksLauncher.c.

493 {
494 int state = EFireworksState.FIRING;
495 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SetState, GetFuseDelay() * 1000, false, state);
496 }
proto native CGame GetGame()
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8

References CALL_CATEGORY_SYSTEM, GetFuseDelay(), GetGame(), and SetState().

Referenced by OnStateChangedServer().

◆ OnIgnitedThis()

override void FireworksLauncher::OnIgnitedThis ( EntityAI fire_source)
inlineprotected

Executed on Server when some item ignited this one.

Definition at line 471 of file FireworksLauncher.c.

472 {
473 super.OnIgnitedThis(fire_source);
474 if (m_Events)
475 m_Events.Clear();
476 m_Index = 0;
477
478 if (m_TimerEvent)
479 m_TimerEvent.Stop();
480 }
ref array< ref FireworksLauncherClientEventBase > m_Events

References m_Events, m_Index, and m_TimerEvent.

◆ OnIndexChangedClient()

void FireworksLauncher::OnIndexChangedClient ( )
inlineprotected

Definition at line 582 of file FireworksLauncher.c.

583 {
584 if (!m_Events)
586 if (m_Index != 0 && m_State == EFireworksState.FIRING)//can only be true when restarting the device during debug calls
587 {
588 FireworksLauncherClientEventBase fireEvent = SpawnEvent();
589 m_Events.Insert(fireEvent);
590 }
591 }
bool m_State
FireworksLauncherClientEventBase SpawnEvent()

References m_Events, m_Index, m_State, and SpawnEvent().

Referenced by OnVariablesSynchronized().

◆ OnPlacementComplete()

void FireworksLauncher::OnPlacementComplete ( Man player,
vector position = "0 0 0",
vector orientation = "0 0 0" )
inlineprotected

Definition at line 387 of file FireworksLauncher.c.

388 {
389 super.OnPlacementComplete(player, position, orientation);
390 if (GetGame().IsServer())
391 {
392 if (GetState() == EFireworksState.DEFAULT)
394 }
395 }

References GetGame(), GetState(), and SetState().

◆ OnStateChangedClient()

void FireworksLauncher::OnStateChangedClient ( EFireworksState currentState)
inlineprotected

Definition at line 454 of file FireworksLauncher.c.

455 {
456 switch (currentState)
457 {
458 case EFireworksState.IGNITED:
460 break
461 case EFireworksState.PLACED:
462 break
463 case EFireworksState.FIRING:
465 break
466 default: {};
467 }
468 }

References OnFiringStartClient(), and OnFuseIgnitedClient().

◆ OnStateChangedServer()

void FireworksLauncher::OnStateChangedServer ( EFireworksState currentState)
inlineprotected

Definition at line 434 of file FireworksLauncher.c.

435 {
436 switch (currentState)
437 {
438 case EFireworksState.PLACED:
439 break
440 case EFireworksState.IGNITED:
442 break
443 case EFireworksState.FIRING:
444 HideSelection("cover");
446 break
447 case EFireworksState.FINISHED:
448 HideSelection("cover");//when loading from storage
449 break
450 default: {};
451 }
452 }

References OnFiringStartServer(), and OnFuseIgnitedServer().

◆ OnStoreLoad()

bool FireworksLauncher::OnStoreLoad ( ParamsReadContext ctx,
int version )
inlineprotected

Definition at line 620 of file FireworksLauncher.c.

621 {
622 if (!super.OnStoreLoad(ctx, version))
623 return false;
624
625 if (version >= 130)
626 {
627 if (!ctx.Read(m_Index))
628 return false;
629
630 if (!ctx.Read(m_State))
631 return false;
632
634 }
635 return true;
636 }

References m_Index, m_State, and SetState().

◆ OnStoreSave()

void FireworksLauncher::OnStoreSave ( ParamsWriteContext ctx)
inlineprotected

Definition at line 612 of file FireworksLauncher.c.

613 {
614 super.OnStoreSave(ctx);
615 ctx.Write(m_Index);
616 ctx.Write(m_State);
617 }

References m_Index, and m_State.

◆ OnVariablesSynchronized()

void FireworksLauncher::OnVariablesSynchronized ( )
inlineprotected

Definition at line 600 of file FireworksLauncher.c.

601 {
602 super.OnVariablesSynchronized();
603 //Print("index: " + m_Index);
604 if (m_Index != m_IndexPrev)
605 {
609 }
610 }
static proto int Randomize(int seed)
Sets the seed for the random number generator.

References m_Index, m_IndexPrev, m_RandomSeed, OnIndexChangedClient(), and Math::Randomize().

◆ RestartEventTimer()

void FireworksLauncher::RestartEventTimer ( )
inlineprotected

Starts event timer.

Definition at line 546 of file FireworksLauncher.c.

547 {
548 if (!m_TimerEvent)
549 m_TimerEvent = new Timer();
550 m_TimerEvent.Run(GetEventDelay(), this, "OnEventServer", new Param1<int>(0));
551 }

References GetEventDelay(), and m_TimerEvent.

Referenced by OnEventServer(), and Anniversary_FireworksLauncher::OnEventServer().

◆ SetupColorSequences()

void FireworksLauncher::SetupColorSequences ( )
inlineprotected

Definition at line 359 of file FireworksLauncher.c.

360 {
361 m_ColorSequence.Insert("RGBYPBRGBRGBYPBRGBRGBYPBRGBPBRGBRGBY");
362 m_ColorSequence.Insert("PGPYPBYPYPBYYPBRPYPBYYPBRGBPBRGRGBRB");
363 m_ColorSequence.Insert("YPBRPYPBYYPBRGBPBRGRGBRBGRPBRGBRYPBY");
364 m_ColorSequence.Insert("YRBGPRYPGRYBGRGRGBRBBYPYPBYRYPGRYGRP");
365 m_ColorSequence.Insert("BGRYPYRPBYYPYRBGPRYPGBYPBRGBPBRGBRGB");
366 m_ColorSequence.Insert("RYGRPBRGBYPBRRPBRGBBRBBYPYPRGBRGBRPY");
367 m_ColorSequence.Insert("GBRGBYRGBYPBRRPBRBYRYPGPYPRGBRGBRPYG");
368 m_ColorSequence.Insert("RYPBYYPBRGBYPBRGBRBGBPBRGRGBRBGRYPYR");
369 m_ColorSequence.Insert("PBRGBYPBRGBRBGBPBRGRGBRBGRYPYRRYPBYY");
370 m_ColorSequence.Insert("RGRGBRBBYPYPBYRYPGRYGRPYRBGPRYPGRYBG");
371 m_ColorSequence.Insert("RBYRYPGPYPRGBRGBRPYGGBRGBYRGBYPBRRPB");
372 m_ColorSequence.Insert("PRGBRGBRPYGGBRRBYRYPGPYGBYRGBYPBRRPB");
373 }

References m_ColorSequence.

Referenced by FireworksLauncher().

◆ SpawnEvent()

FireworksLauncherClientEventBase FireworksLauncher::SpawnEvent ( )
inlineprotected

Definition at line 593 of file FireworksLauncher.c.

594 {
595 FireworksLauncherClientEventBase evnt = new FireworksLauncherClientEvent(this, m_Index);
596 evnt.OnFired();
597 return evnt;
598 }

References m_Index.

Referenced by OnIndexChangedClient().

◆ UsesGlobalDeploy()

bool FireworksLauncher::UsesGlobalDeploy ( )
inlineprotected

Definition at line 343 of file FireworksLauncher.c.

344 {
345 return true;
346 }

Member Data Documentation

◆ m_ColorSequence

ref array<string> FireworksLauncher::m_ColorSequence
private

◆ m_ColorSequenceIndex

int FireworksLauncher::m_ColorSequenceIndex
private

Definition at line 315 of file FireworksLauncher.c.

Referenced by FireworksLauncher(), and GetColorSequence().

◆ m_Events

ref array<ref FireworksLauncherClientEventBase> FireworksLauncher::m_Events
private

Definition at line 317 of file FireworksLauncher.c.

Referenced by OnIgnitedThis(), and OnIndexChangedClient().

◆ m_FuseSound

EffectSound FireworksLauncher::m_FuseSound
private

◆ m_FuseSoundStart

EffectSound FireworksLauncher::m_FuseSoundStart
private

Definition at line 318 of file FireworksLauncher.c.

Referenced by OnFuseIgnitedClient(), and ~FireworksLauncher().

◆ m_Index

◆ m_IndexPrev

int FireworksLauncher::m_IndexPrev
private

Definition at line 314 of file FireworksLauncher.c.

Referenced by OnVariablesSynchronized().

◆ m_ParticleAfterBurnEnd

ParticleSource FireworksLauncher::m_ParticleAfterBurnEnd
private

Definition at line 321 of file FireworksLauncher.c.

◆ m_ParticleFuse

ParticleSource FireworksLauncher::m_ParticleFuse
private

Definition at line 320 of file FireworksLauncher.c.

Referenced by OnFiringStartClient(), and OnFuseIgnitedClient().

◆ m_TimerFuse

ref Timer FireworksLauncher::m_TimerFuse
private

Definition at line 316 of file FireworksLauncher.c.


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