Dayz Explorer 1.28.160049
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":
8 return ParticleList.FIREWORKS_EXPLOSION_THANKS1;
9 case "2":
10 return ParticleList.FIREWORKS_EXPLOSION_THANKS2;
11 case "3":
12 return ParticleList.FIREWORKS_EXPLOSION_THANKS3;
13 case "4":
14 return ParticleList.FIREWORKS_EXPLOSION_THANKS4;
15 case "5":
16 return ParticleList.FIREWORKS_EXPLOSION_THANKS5;
17 default:
18 ErrorEx("Incorrect explosion particle color in the sequence");
19 }
20 return ParticleList.FIREWORKS_EXPLOSION_RED;
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
53 override protected void SpawnSecondaryExplosion()
54 {
55 AnniversaryFireworksLauncherClientEventSecondary evnt = new AnniversaryFireworksLauncherClientEventSecondary(m_Item,m_Index);
56 evnt.Init(GetExplosionPosition());
57 evnt.OnExplode();
58 m_Events.Insert(evnt);
60 }
61}
62//--------------------------------------------------------------------------------------
63class AnniversaryFireworksLauncherClientEventSecondary : AnniversaryFireworksLauncherClientEvent
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);
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
119 override bool CanSwapEntities(EntityAI otherItem, InventoryLocation otherDestination, InventoryLocation destination)
120 {
121 return false;
122 }
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 {
154 m_Index = GetMaxShots();
155 m_TimerEvent = null;
156 SetState(EFireworksState.FINISHED);
157 }
158 else
159 {
161 }
162 }
163
164}
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.
InventoryLocation.
Definition enmath.c:7
static Particle PlayInWorld(int particle_id, vector global_pos)
Creates a particle emitter on the given position and activates it.
Definition particle.c:174
override Widget Init()
Definition dayzgame.c:127
Particle m_ParticleExplosion
particle
ref Timer m_TimerEvent
EFireworksState
FireworksLauncherClientEvent m_ShotPos
AnniversaryFireworksLauncherClientEvent m_ShotPos
proto native CGame GetGame()
enum ShapeType ErrorEx
class JsonUndergroundAreaTriggerData GetPosition
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
void SetState(bool state)