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

Protected Member Functions

int GetSoundDelay ()
 
int GetLightDelay ()
 
float GetExplosionDistance ()
 
float GetShotDispersionAngle ()
 
string GetExplosionSoundSet ()
 
float GetExplosionDelay ()
 
void FireworksLauncherClientEvent (FireworksLauncher item, int index)
 
void ~FireworksLauncherClientEvent ()
 
void OnFired ()
 
vector GetShotPos ()
 
void CalculateExplosionPosition ()
 
vector GetExplosionPosition ()
 
int GetSecondaryExplosionCount ()
 
void OnExplode ()
 
void RequestSecondaryExplosion ()
 
void SpawnSecondaryExplosion ()
 
int GetSecondaryExplosionDelay ()
 
int GetExplParticleFromSequence ()
 
void SetupLight (PointLightBase light)
 
void SpawnLight ()
 
void PlayExplosionSound ()
 

Protected Attributes

ref Timer m_Timer = new Timer()
 
FireworksLauncher m_Item
 
int m_Index
 
vector m_ExplosionPos
 
EffectSound m_FireSound
 
EffectSound m_ExplosionSound
 
ParticleSource m_ParticleShot
 
ParticleSource m_ParticleExplosion
 
vector m_ShotDir
 
ExplosionLight m_ExplosionLight
 
ParticleSource m_ParticleAfterBurnEnd
 
string m_Color
 
int m_RemainingExplosions = GetSecondaryExplosionCount()
 
ref array< ref FireworksLauncherClientEventBase > m_Events = new ref array<ref FireworksLauncherClientEventBase>
 

Detailed Description

Definition at line 28 of file FireworksLauncher.c.

Constructor & Destructor Documentation

◆ FireworksLauncherClientEvent()

void FireworksLauncherClientEvent::FireworksLauncherClientEvent ( FireworksLauncher item,
int index )
inlineprotected

Definition at line 88 of file FireworksLauncher.c.

89 {
90 m_Item = item;
91 m_Index = index;
92
94 int coloreSequenceIndex = m_Index - 1;//shot index(m_Index) starts at 1
95
98 else
99 {
100 Debug.LogError("Failed to obtain color from color sequence");
101 m_Color = "B";
102 }
103 }
Definition Debug.c:14
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Definition Debug.c:341
proto native int Length()
Returns length of string.
proto string Get(int index)
Gets n-th character from string.

References string::Get(), FireworksLauncher::GetColorSequence(), string::Length(), Debug::LogError(), m_Color, m_Index, and m_Item.

◆ ~FireworksLauncherClientEvent()

void FireworksLauncherClientEvent::~FireworksLauncherClientEvent ( )
inlineprotected

Definition at line 105 of file FireworksLauncher.c.

106 {
111 }
override bool StopParticle(int flags=0)
Method to tell the particle to stop playing.
Manager class for managing Effect (EffectParticle, EffectSound)
static void DestroyEffect(Effect effect)
Unregisters, stops and frees the Effect.

References SEffectManager::DestroyEffect(), m_ExplosionSound, m_FireSound, m_ParticleAfterBurnEnd, and ParticleSource::StopParticle().

Member Function Documentation

◆ CalculateExplosionPosition()

void FireworksLauncherClientEvent::CalculateExplosionPosition ( )
inlineprotected

◆ GetExplosionDelay()

float FireworksLauncherClientEvent::GetExplosionDelay ( )
inlineprotected

Definition at line 78 of file FireworksLauncher.c.

79 {
80 return Math.RandomFloatInclusive(1.5, 1.75);
81 }
Definition EnMath.c:7
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 OnFired().

◆ GetExplosionDistance()

float FireworksLauncherClientEvent::GetExplosionDistance ( )
inlineprotected

Definition at line 63 of file FireworksLauncher.c.

64 {
65 return Math.RandomFloatInclusive(35, 40);
66 }

References Math::RandomFloatInclusive().

Referenced by CalculateExplosionPosition(), and OnFired().

◆ GetExplosionPosition()

vector FireworksLauncherClientEvent::GetExplosionPosition ( )
inlineprotected

◆ GetExplosionSoundSet()

string FireworksLauncherClientEvent::GetExplosionSoundSet ( )
inlineprotected

Definition at line 73 of file FireworksLauncher.c.

74 {
75 return "FireworksLauncher_Explosion_SoundSet";
76 }

Referenced by PlayExplosionSound().

◆ GetExplParticleFromSequence()

int FireworksLauncherClientEvent::GetExplParticleFromSequence ( )
inlineprotected

Definition at line 211 of file FireworksLauncher.c.

212 {
213 switch (m_Color)
214 {
215 case "R":
217 case "G":
219 case "B":
221 case "Y":
223 case "P":
225 default:
226 ErrorEx("Incorrect explosion particle color in the sequence");
227 }
229 }
static const int FIREWORKS_EXPLOSION_YELLOW
static const int FIREWORKS_EXPLOSION_BLUE
static const int FIREWORKS_EXPLOSION_RED
static const int FIREWORKS_EXPLOSION_GREEN
static const int FIREWORKS_EXPLOSION_PINK
enum ShapeType ErrorEx

References ErrorEx, ParticleList::FIREWORKS_EXPLOSION_BLUE, ParticleList::FIREWORKS_EXPLOSION_GREEN, ParticleList::FIREWORKS_EXPLOSION_PINK, ParticleList::FIREWORKS_EXPLOSION_RED, ParticleList::FIREWORKS_EXPLOSION_YELLOW, and m_Color.

Referenced by OnExplode().

◆ GetLightDelay()

int FireworksLauncherClientEvent::GetLightDelay ( )
inlineprotected

Definition at line 58 of file FireworksLauncher.c.

59 {
60 return 0;
61 }

Referenced by OnExplode().

◆ GetSecondaryExplosionCount()

int FireworksLauncherClientEvent::GetSecondaryExplosionCount ( )
inlineprotected

Definition at line 163 of file FireworksLauncher.c.

164 {
165 return 4;
166 }

◆ GetSecondaryExplosionDelay()

int FireworksLauncherClientEvent::GetSecondaryExplosionDelay ( )
inlineprotected

Definition at line 206 of file FireworksLauncher.c.

207 {
208 return Math.RandomIntInclusive(100, 250);
209 }
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:54

References Math::RandomIntInclusive().

Referenced by RequestSecondaryExplosion().

◆ GetShotDispersionAngle()

float FireworksLauncherClientEvent::GetShotDispersionAngle ( )
inlineprotected

Definition at line 68 of file FireworksLauncher.c.

69 {
70 return Math.RandomFloatInclusive(-25, 25); //this is rotated 360 degrees around the UP vector too
71 }

References Math::RandomFloatInclusive().

Referenced by OnFired().

◆ GetShotPos()

vector FireworksLauncherClientEvent::GetShotPos ( )
inlineprotected

Definition at line 133 of file FireworksLauncher.c.

134 {
136 string memName = "Shot_" + m_Index;
137
138 if (m_Item.MemoryPointExists(memName))
139 {
140 memPos = m_Item.GetMemoryPointPos(memName);
141 memPos = m_Item.ModelToWorld(memPos);
142 }
143 else
144 {
145 memPos = m_Item.GetPosition();//fallback to item's location
146 Debug.LogError("Missing shot memory point on Fireworks");
147 }
148 return memPos;
149 }

References Debug::LogError(), m_Index, and m_Item.

Referenced by CalculateExplosionPosition(), and OnFired().

◆ GetSoundDelay()

int FireworksLauncherClientEvent::GetSoundDelay ( )
inlineprotected

Definition at line 53 of file FireworksLauncher.c.

54 {
55 return 0;
56 }

Referenced by OnExplode().

◆ OnExplode()

void FireworksLauncherClientEvent::OnExplode ( )
inlineprotected

Definition at line 169 of file FireworksLauncher.c.

170 {
171#ifdef DEVELOPER
173 {
174 m_ShotTrajectory.Destroy();
176 }
177#endif
179
180 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(PlayExplosionSound, GetSoundDelay(), false);
181 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SpawnLight, GetLightDelay(), false);
183
185
186 }
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Definition Particle.c:262
proto native CGame GetGame()
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8

References CALL_CATEGORY_SYSTEM, GetExplosionPosition(), GetExplParticleFromSequence(), GetGame(), GetLightDelay(), GetSoundDelay(), m_ParticleAfterBurnEnd, m_ParticleExplosion, ParticleManager(), PlayExplosionSound(), RequestSecondaryExplosion(), SpawnLight(), and Particle::Stop().

◆ OnFired()

void FireworksLauncherClientEvent::OnFired ( )
inlineprotected

Definition at line 113 of file FireworksLauncher.c.

114 {
115 m_Timer.Run(GetExplosionDelay(), this, "OnExplode", null);
116 m_Item.PlaySoundSet(m_FireSound, "FireworksLauncher_Shot_SoundSet", 0, 0);
119
123 m_ShotDir = m_ParticleShot.GetDirectionUp();
124
125#ifdef DEVELOPER
126 vector pts[2];
127 pts[0] = GetShotPos();
129 //m_ShotTrajectory = Shape.CreateLines(COLOR_RED, ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE|ShapeFlags.NOZBUFFER, pts, 2);
130#endif
131 }
static const int FIREWORKS_AFTERBURN_END
static const int FIREWORKS_SHOT
proto native void SetOwner(Class owner)
Set the owner of this ParticleSource.
proto native vector Vector(float x, float y, float z)
Vector constructor from components.

References ParticleList::FIREWORKS_AFTERBURN_END, ParticleList::FIREWORKS_SHOT, GetExplosionDelay(), GetExplosionDistance(), GetShotDispersionAngle(), GetShotPos(), m_FireSound, m_Item, m_ParticleAfterBurnEnd, m_ParticleShot, m_ShotDir, m_Timer, ParticleManager(), Math::RandomFloatInclusive(), ParticleSource::SetOwner(), and Vector().

◆ PlayExplosionSound()

void FireworksLauncherClientEvent::PlayExplosionSound ( )
inlineprotected

Definition at line 267 of file FireworksLauncher.c.

268 {
269 if (m_FireSound)
271 m_Item.PlaySoundSet(m_ExplosionSound, GetExplosionSoundSet(), 0, 0);
272 }
override void Stop()
Stops sound.

References GetExplosionSoundSet(), m_ExplosionSound, m_FireSound, m_Item, and EffectSound::Stop().

Referenced by OnExplode().

◆ RequestSecondaryExplosion()

◆ SetupLight()

void FireworksLauncherClientEvent::SetupLight ( PointLightBase light)
inlineprotected

Definition at line 231 of file FireworksLauncher.c.

232 {
233 switch (m_Color)
234 {
235 case "R":
236 light.SetDiffuseColor(255, 51, 51);
237 light.SetAmbientColor(255, 51, 51);
238
239 break;
240 case "G":
241 light.SetDiffuseColor(0, 255, 128);
242 light.SetAmbientColor(0, 255, 128);
243 break;
244 case "B":
245 light.SetDiffuseColor(51, 153, 255);
246 light.SetAmbientColor(51, 153, 255);
247 break;
248 case "Y":
249 light.SetDiffuseColor(255, 255, 51);
250 light.SetAmbientColor(255, 255, 51);
251 break;
252 case "P":
253 light.SetDiffuseColor(255, 102, 255);
254 light.SetAmbientColor(255, 102, 255);
255 break;
256 default:
257 ErrorEx("Incorrect explosion particle color in the sequence");
258 }
259 }

References ErrorEx, and m_Color.

Referenced by SpawnLight().

◆ SpawnLight()

void FireworksLauncherClientEvent::SpawnLight ( )
inlineprotected

◆ SpawnSecondaryExplosion()

void FireworksLauncherClientEvent::SpawnSecondaryExplosion ( )
inlineprotected

Definition at line 197 of file FireworksLauncher.c.

198 {
201 evnt.OnExplode();
202 m_Events.Insert(evnt);
204 }
ref array< ref FireworksLauncherClientEventBase > m_Events

References GetExplosionPosition(), m_Events, m_Index, m_Item, and RequestSecondaryExplosion().

Referenced by RequestSecondaryExplosion().

Member Data Documentation

◆ m_Color

◆ m_Events

ref array<ref FireworksLauncherClientEventBase> FireworksLauncherClientEvent::m_Events = new ref array<ref FireworksLauncherClientEventBase>
protected

◆ m_ExplosionLight

ExplosionLight FireworksLauncherClientEvent::m_ExplosionLight
protected

Definition at line 39 of file FireworksLauncher.c.

Referenced by SpawnLight().

◆ m_ExplosionPos

vector FireworksLauncherClientEvent::m_ExplosionPos
protected

Definition at line 33 of file FireworksLauncher.c.

Referenced by CalculateExplosionPosition(), and GetExplosionPosition().

◆ m_ExplosionSound

EffectSound FireworksLauncherClientEvent::m_ExplosionSound
protected

Definition at line 35 of file FireworksLauncher.c.

Referenced by PlayExplosionSound(), and ~FireworksLauncherClientEvent().

◆ m_FireSound

EffectSound FireworksLauncherClientEvent::m_FireSound
protected

Definition at line 34 of file FireworksLauncher.c.

Referenced by OnFired(), PlayExplosionSound(), and ~FireworksLauncherClientEvent().

◆ m_Index

int FireworksLauncherClientEvent::m_Index
protected

◆ m_Item

◆ m_ParticleAfterBurnEnd

ParticleSource FireworksLauncherClientEvent::m_ParticleAfterBurnEnd
protected

Definition at line 40 of file FireworksLauncher.c.

Referenced by OnExplode(), OnFired(), and ~FireworksLauncherClientEvent().

◆ m_ParticleExplosion

ParticleSource FireworksLauncherClientEvent::m_ParticleExplosion
protected

Definition at line 37 of file FireworksLauncher.c.

Referenced by OnExplode().

◆ m_ParticleShot

ParticleSource FireworksLauncherClientEvent::m_ParticleShot
protected

Definition at line 36 of file FireworksLauncher.c.

Referenced by OnFired().

◆ m_RemainingExplosions

int FireworksLauncherClientEvent::m_RemainingExplosions = GetSecondaryExplosionCount()
protected

Definition at line 42 of file FireworksLauncher.c.

Referenced by RequestSecondaryExplosion().

◆ m_ShotDir

vector FireworksLauncherClientEvent::m_ShotDir
protected

Definition at line 38 of file FireworksLauncher.c.

Referenced by CalculateExplosionPosition(), and OnFired().

◆ m_Timer

ref Timer FireworksLauncherClientEvent::m_Timer = new Timer()
protected

Definition at line 30 of file FireworksLauncher.c.

Referenced by OnFired().


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