Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
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);
59  RequestSecondaryExplosion();
60  }
61 }
62 //--------------------------------------------------------------------------------------
63 class 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);
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 
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  {
160  RestartEventTimer();
161  }
162  }
163 
164 }
GetGame
proto native CGame GetGame()
CALL_CATEGORY_SYSTEM
const int CALL_CATEGORY_SYSTEM
Definition: tools.c:8
m_TimerEvent
protected ref Timer m_TimerEvent
Definition: fireworksbase.c:15
GetExplosionPosition
override protected vector GetExplosionPosition()
Definition: fireworkslauncher.c:288
GetExplosionPosition
override protected vector GetExplosionPosition()
Definition: fireworkslauncheranniversary.c:67
PointLightBase
Definition: staticobj_roadblock_wood_small.c:27
InventoryLocation
InventoryLocation.
Definition: inventorylocation.c:27
FireworksLauncherClientEvent
Definition: fireworkslauncher.c:28
EFireworksState
EFireworksState
Definition: fireworksbase.c:2
m_Item
protected EntityAI m_Item
Definition: radialquickbarmenu.c:14
Init
void Init(vector pos)
Definition: fireworkslauncheranniversary.c:72
GetDamageType
int GetDamageType()
Definition: areadamagemanager.c:269
m_ShotPos
AnniversaryFireworksLauncherClientEvent m_ShotPos
ErrorEx
enum ShapeType ErrorEx
GetPosition
class JsonUndergroundAreaTriggerData GetPosition
Definition: undergroundarealoader.c:9
ParticleList
Definition: particlelist.c:11
vector
Definition: enconvert.c:105
SetState
void SetState(bool state)
Definition: staminahandler.c:30
FireworksLauncher
Definition: fireworkslauncher.c:319
GetShotPos
override protected vector GetShotPos()
Definition: fireworkslauncheranniversary.c:80
Anniversary_FireworksLauncher
Definition: fireworkslauncheranniversary.c:98
OnExplode
override void OnExplode()
Definition: fireworkslauncheranniversary.c:90
m_Color
string m_Color
Definition: enentity.c:848
AnniversaryFireworksLauncherClientEvent
Definition: fireworkslauncheranniversary.c:1
m_ParticleExplosion
protected Particle m_ParticleExplosion
particle
Definition: explosivesbase.c:34
GetAmmoType
proto native string GetAmmoType()
Math
Definition: enmath.c:6
ParticleManager
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Definition: particlemanager.c:84
EntityAI
Definition: building.c:5
GetExplosionDistance
override protected float GetExplosionDistance()
Definition: fireworkslauncheranniversary.c:85