DayZ 1.24
Loading...
Searching...
No Matches
FireworksLauncherAnniversary.c
Go to the documentation of this file.
2{
3 override protected int GetExplParticleFromSequence()
4 {
5 switch (m_Color)
6 {
7 case "1":
9 case "2":
11 case "3":
13 case "4":
15 case "5":
17 default:
18 ErrorEx("Incorrect explosion particle color in the sequence");
19 }
21 }
22
23 override protected void SetupLight(PointLightBase light)
24 {
25 switch (m_Color)
26 {
27 case "1":
28 light.SetDiffuseColor(255, 51, 51);
29 light.SetAmbientColor(255, 51, 51);
30
31 break;
32 case "2":
33 light.SetDiffuseColor(0, 255, 128);
34 light.SetAmbientColor(0, 255, 128);
35 break;
36 case "3":
37 light.SetDiffuseColor(51, 153, 255);
38 light.SetAmbientColor(51, 153, 255);
39 break;
40 case "4":
41 light.SetDiffuseColor(255, 255, 51);
42 light.SetAmbientColor(255, 255, 51);
43 break;
44 case "5":
45 light.SetDiffuseColor(255, 102, 255);
46 light.SetAmbientColor(255, 102, 255);
47 break;
48 default:
49 ErrorEx("Incorrect explosion particle color in the sequence");
50 }
51 }
52
61}
62//--------------------------------------------------------------------------------------
64{
65 protected vector m_ShotPos;
66
67 override protected vector GetExplosionPosition()
68 {
69 return GetShotPos() + m_ShotDir * GetExplosionDistance();
70 }
71
72 void Init(vector pos)
73 {
74 m_ShotPos = pos;
75 m_ShotDir[0] = Math.RandomFloatInclusive(-1, 1);
76 m_ShotDir[1] = Math.RandomFloatInclusive(-1, 1);
77 m_ShotDir[2] = Math.RandomFloatInclusive(-1, 1);
78 m_ShotDir.Normalize();
79 }
80 override protected vector GetShotPos()
81 {
82 return m_ShotPos;
83 }
84
85 override protected float GetExplosionDistance()
86 {
87 return Math.RandomFloatInclusive(10, 15);
88 }
89
90 override void OnExplode()
91 {
92 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(PlayExplosionSound, GetSoundDelay(), false);
93 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SpawnLight, GetLightDelay(), false);
94 m_ParticleExplosion = ParticleManager.GetInstance().PlayInWorld(GetExplParticleFromSequence(), GetExplosionPosition());
95 }
96}
97//--------------------------------------------------------------------------------------
99{
100 int sequence = 0;
101
102 override protected void SetupColorSequences()
103 {
104 m_ColorSequence.Insert("1234512345123451234512345");
105 }
106
107 override protected FireworksLauncherClientEventBase SpawnEvent()
108 {
109 FireworksLauncherClientEventBase evnt = new AnniversaryFireworksLauncherClientEvent(this, m_Index);
110 evnt.OnFired();
111 return evnt;
112 }
113
114 override bool IsTakeable()
115 {
116 return false;
117 }
118
123
124 override bool DisableVicinityIcon()
125 {
126 return true;
127 }
128
129 override protected int GetMaxShots()
130 {
131 return 25;
132 }
133
134 override protected float GetFuseDelay()
135 {
136 return 1;
137 }
138
140 override protected void OnEventServer(int type)
141 {
142 m_Index++;
143 DamageSystem.ExplosionDamage(this, NULL, GetAmmoType(), GetPosition(), GetDamageType());
144
145 if (m_Index > 16)
146 {
147 sequence++;
148 m_Index = 1;
149 }
150
151 SetSynchDirty();
152 if (m_Index + (sequence * 16) > GetMaxShots())
153 {
156 SetState(EFireworksState.FINISHED);
157 }
158 else
160 }
161
162}
override Widget Init()
Definition DayZGame.c:120
void OnExplode()
Particle m_ParticleExplosion
particle
ref Timer m_TimerEvent
EFireworksState
vector GetExplosionPosition()
float GetExplosionDistance()
vector GetShotPos()
FireworksLauncherClientEvent m_ShotPos
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
void SetState(bool state)
class JsonUndergroundAreaTriggerData GetPosition
override bool CanSwapEntities(EntityAI otherItem, InventoryLocation otherDestination, InventoryLocation destination)
FireworksLauncherClientEventBase SpawnEvent()
void OnEventServer(int type)
Called periodically but only after the entity gets ignited.
ref array< ref FireworksLauncherClientEventBase > m_Events
void RestartEventTimer()
Starts event timer.
ref array< string > m_ColorSequence
InventoryLocation.
Definition EnMath.c:7
static const int FIREWORKS_EXPLOSION_THANKS2
static const int FIREWORKS_EXPLOSION_THANKS4
static const int FIREWORKS_EXPLOSION_THANKS1
static const int FIREWORKS_EXPLOSION_RED
static const int FIREWORKS_EXPLOSION_THANKS5
static const int FIREWORKS_EXPLOSION_THANKS3
proto native CGame GetGame()
enum ShapeType ErrorEx
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8