fireworkslauncher.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. class ExplosionLight : PointLightBase
  2. {
  3. void ExplosionLight()
  4. {
  5. SetVisibleDuringDaylight(true);
  6. SetRadiusTo(60);
  7. SetBrightnessTo(0.05);
  8. SetFlareVisible(false);
  9. SetAmbientColor(1.0, 1.0, 1.0);
  10. SetDiffuseColor(1.0, 1.0, 1.0);
  11. SetLifetime(2.1);
  12. //SetDisableShadowsWithinRadius(-1);
  13. SetFadeOutTime(1);
  14. m_FadeInTime = 0.25;
  15. SetFlickerSpeed(7);
  16. //SetFlickerAmplitude(0.5);
  17. SetFlickerAmplitudeMax(3);
  18. SetFlickerAmplitudeMin(0);
  19. SetCastShadow( false );
  20. }
  21. }
  22. //-----------------------------------------------------------------------------------------------
  23. class FireworksLauncherClientEventBase
  24. {
  25. void OnFired();
  26. }
  27. //-----------------------------------------------------------------------------------------------
  28. class FireworksLauncherClientEvent : FireworksLauncherClientEventBase
  29. {
  30. protected ref Timer m_Timer = new Timer();
  31. protected FireworksLauncher m_Item;
  32. protected int m_Index;
  33. protected vector m_ExplosionPos;
  34. protected EffectSound m_FireSound;
  35. protected EffectSound m_ExplosionSound;
  36. protected ParticleSource m_ParticleShot;
  37. protected ParticleSource m_ParticleExplosion;
  38. protected vector m_ShotDir;
  39. protected ExplosionLight m_ExplosionLight;
  40. protected ParticleSource m_ParticleAfterBurnEnd;
  41. protected string m_Color;
  42. protected int m_RemainingExplosions = GetSecondaryExplosionCount();
  43. protected ref array<ref FireworksLauncherClientEventBase> m_Events = new ref array<ref FireworksLauncherClientEventBase>;
  44. #ifdef DEVELOPER
  45. Shape m_ShotTrajectory;
  46. #endif
  47. // -----------------------------
  48. // ------- Tweaking Start-------
  49. // -----------------------------
  50. protected int GetSoundDelay()
  51. {
  52. return 0;
  53. }
  54. protected int GetLightDelay()
  55. {
  56. return 0;
  57. }
  58. protected float GetExplosionDistance()
  59. {
  60. return Math.RandomFloatInclusive(35,40);
  61. }
  62. protected float GetShotDispersionAngle()
  63. {
  64. return Math.RandomFloatInclusive(-25,25);//this is rotated 360 degrees around the UP vector too
  65. }
  66. protected string GetExplosionSoundSet()
  67. {
  68. return "FireworksLauncher_Explosion_SoundSet";
  69. }
  70. protected float GetExplosionDelay()
  71. {
  72. return Math.RandomFloatInclusive(1.5,1.75);
  73. }
  74. // -----------------------------
  75. // ------- Tweaking End --------
  76. // -----------------------------
  77. void FireworksLauncherClientEvent(FireworksLauncher item, int index)
  78. {
  79. m_Item = item;
  80. m_Index = index;
  81. int colorSequenceLastIndex = m_Item.GetColorSequence().Length() - 1;
  82. int coloreSequenceIndex = m_Index - 1;//shot index(m_Index) starts at 1
  83. if (colorSequenceLastIndex >= coloreSequenceIndex)
  84. {
  85. m_Color = m_Item.GetColorSequence().Get(coloreSequenceIndex);
  86. }
  87. else
  88. {
  89. Debug.LogError("Failed to obtain color from color sequence");
  90. m_Color = "B";
  91. }
  92. }
  93. void ~FireworksLauncherClientEvent()
  94. {
  95. SEffectManager.DestroyEffect(m_FireSound);
  96. SEffectManager.DestroyEffect(m_ExplosionSound);
  97. if (m_ParticleAfterBurnEnd)
  98. {
  99. m_ParticleAfterBurnEnd.StopParticle();
  100. }
  101. }
  102. override protected void OnFired()
  103. {
  104. m_Timer.Run(GetExplosionDelay(), this, "OnExplode", null);
  105. m_Item.PlaySoundSet( m_FireSound, "FireworksLauncher_Shot_SoundSet", 0, 0 );
  106. m_ParticleShot = ParticleManager.GetInstance().PlayInWorld(ParticleList.FIREWORKS_SHOT, GetShotPos());
  107. m_ParticleShot.SetYawPitchRoll(Vector(Math.RandomFloatInclusive(0,360),GetShotDispersionAngle(),0));
  108. m_ParticleAfterBurnEnd = ParticleManager.GetInstance().PlayInWorld(ParticleList.FIREWORKS_AFTERBURN_END, GetShotPos());
  109. if (m_ParticleAfterBurnEnd)
  110. m_ParticleAfterBurnEnd.SetOwner(this);
  111. m_ShotDir = m_ParticleShot.GetDirectionUp();
  112. #ifdef DEVELOPER
  113. vector pts[2];
  114. pts[0] = GetShotPos();
  115. pts[1] = GetShotPos() + m_ShotDir * GetExplosionDistance();
  116. //m_ShotTrajectory = Shape.CreateLines(COLOR_RED, ShapeFlags.TRANSP|ShapeFlags.NOOUTLINE|ShapeFlags.NOZBUFFER, pts, 2);
  117. #endif
  118. }
  119. protected vector GetShotPos()
  120. {
  121. vector memPos;
  122. string memName = "Shot_" + m_Index;
  123. if (m_Item.MemoryPointExists(memName))
  124. {
  125. memPos = m_Item.GetMemoryPointPos(memName);
  126. memPos = m_Item.ModelToWorld(memPos);
  127. }
  128. else
  129. {
  130. memPos = m_Item.GetPosition();//fallback to item's location
  131. Debug.LogError("Missing shot memory point on Fireworks");
  132. }
  133. return memPos;
  134. }
  135. protected void CalculateExplosionPosition()
  136. {
  137. m_ExplosionPos = GetShotPos() + m_ShotDir * GetExplosionDistance();
  138. }
  139. protected vector GetExplosionPosition()
  140. {
  141. if (!m_ExplosionPos)
  142. {
  143. CalculateExplosionPosition();
  144. }
  145. return m_ExplosionPos;
  146. }
  147. int GetSecondaryExplosionCount()
  148. {
  149. return 4;
  150. }
  151. protected void OnExplode()
  152. {
  153. #ifdef DEVELOPER
  154. if (m_ShotTrajectory)
  155. {
  156. m_ShotTrajectory.Destroy();
  157. m_ShotTrajectory = null;
  158. }
  159. #endif
  160. m_ParticleAfterBurnEnd.Stop();
  161. GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( PlayExplosionSound, GetSoundDelay(), false);
  162. GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( SpawnLight, GetLightDelay(), false);
  163. m_ParticleExplosion = ParticleManager.GetInstance().PlayInWorld(GetExplParticleFromSequence(), GetExplosionPosition());
  164. RequestSecondaryExplosion();
  165. }
  166. protected void RequestSecondaryExplosion()
  167. {
  168. if (m_RemainingExplosions> 0)
  169. {
  170. m_RemainingExplosions--;
  171. GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( SpawnSecondaryExplosion, GetSecondaryExplosionDelay(), false);
  172. }
  173. }
  174. protected void SpawnSecondaryExplosion()
  175. {
  176. FireworksLauncherClientEventSecondary evnt = new FireworksLauncherClientEventSecondary(m_Item,m_Index);
  177. evnt.Init(GetExplosionPosition());
  178. evnt.OnExplode();
  179. m_Events.Insert(evnt);
  180. RequestSecondaryExplosion();
  181. }
  182. protected int GetSecondaryExplosionDelay()
  183. {
  184. return Math.RandomIntInclusive(100,250);
  185. }
  186. protected int GetExplParticleFromSequence()
  187. {
  188. switch (m_Color)
  189. {
  190. case "R":
  191. return ParticleList.FIREWORKS_EXPLOSION_RED;
  192. case "G":
  193. return ParticleList.FIREWORKS_EXPLOSION_GREEN;
  194. case "B":
  195. return ParticleList.FIREWORKS_EXPLOSION_BLUE;
  196. case "Y":
  197. return ParticleList.FIREWORKS_EXPLOSION_YELLOW;
  198. case "P":
  199. return ParticleList.FIREWORKS_EXPLOSION_PINK;
  200. default:
  201. ErrorEx("Incorrect explosion particle color in the sequence");
  202. }
  203. return ParticleList.FIREWORKS_EXPLOSION_RED;
  204. }
  205. protected void SetupLight(PointLightBase light)
  206. {
  207. switch (m_Color)
  208. {
  209. case "R":
  210. light.SetDiffuseColor(255,51,51);
  211. light.SetAmbientColor(255,51,51);
  212. break;
  213. case "G":
  214. light.SetDiffuseColor(0,255,128);
  215. light.SetAmbientColor(0,255,128);
  216. break;
  217. case "B":
  218. light.SetDiffuseColor(51,153,255);
  219. light.SetAmbientColor(51,153,255);
  220. break;
  221. case "Y":
  222. light.SetDiffuseColor(255,255,51);
  223. light.SetAmbientColor(255,255,51);
  224. break;
  225. case "P":
  226. light.SetDiffuseColor(255,102,255);
  227. light.SetAmbientColor(255,102,255);
  228. break;
  229. default:
  230. ErrorEx("Incorrect explosion particle color in the sequence");
  231. }
  232. }
  233. protected void SpawnLight()
  234. {
  235. m_ExplosionLight = ExplosionLight.Cast( ScriptedLightBase.CreateLight( ExplosionLight, GetExplosionPosition()) );
  236. SetupLight(m_ExplosionLight);
  237. }
  238. protected void PlayExplosionSound()
  239. {
  240. if (m_FireSound)
  241. {
  242. m_FireSound.Stop();
  243. }
  244. m_Item.PlaySoundSet( m_ExplosionSound, GetExplosionSoundSet(), 0, 0 );
  245. }
  246. }
  247. //------------------------------------------------------------------------------------
  248. class FireworksLauncherClientEventSecondary : FireworksLauncherClientEvent
  249. {
  250. protected vector m_ShotPos;
  251. override protected vector GetExplosionPosition()
  252. {
  253. return GetShotPos() + m_ShotDir * GetExplosionDistance();
  254. }
  255. void Init(vector pos)
  256. {
  257. m_ShotPos = pos;
  258. m_ShotDir[0] = Math.RandomFloatInclusive(-1,1);
  259. m_ShotDir[1] = Math.RandomFloatInclusive(-1,1);
  260. m_ShotDir[2] = Math.RandomFloatInclusive(-1,1);
  261. m_ShotDir.Normalize();
  262. }
  263. override protected vector GetShotPos()
  264. {
  265. return m_ShotPos;
  266. }
  267. override protected float GetExplosionDistance()
  268. {
  269. return Math.RandomFloatInclusive(10,15);
  270. }
  271. override void OnExplode()
  272. {
  273. GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( PlayExplosionSound, GetSoundDelay(), false);
  274. GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( SpawnLight, GetLightDelay(), false);
  275. m_ParticleExplosion = ParticleManager.GetInstance().PlayInWorld(GetExplParticleFromSequence(), GetExplosionPosition());
  276. }
  277. }
  278. class FireworksLauncher: FireworksBase
  279. {
  280. int m_Index;//counts the shots
  281. int m_IndexPrev;//counts the shots
  282. int m_ColorSequenceIndex;
  283. ref Timer m_TimerFuse;
  284. ref array<ref FireworksLauncherClientEventBase> m_Events;
  285. EffectSound m_FuseSoundStart;
  286. EffectSound m_FuseSound;
  287. ParticleSource m_ParticleFuse;
  288. ParticleSource m_ParticleAfterBurnEnd;
  289. ref array<string> m_ColorSequence;
  290. void FireworksLauncher()
  291. {
  292. m_ColorSequence = new array<string>();
  293. SetupColorSequences();
  294. RegisterNetSyncVariableInt("m_State", 0, EnumTools.GetLastEnumValue(EFireworksState));
  295. RegisterNetSyncVariableInt("m_Index", 0, GetMaxShots());
  296. RegisterNetSyncVariableInt("m_RandomSeed", 0, 1023);
  297. int lastIndex = m_ColorSequence.Count() - 1;
  298. RegisterNetSyncVariableInt("m_ColorSequenceIndex", 0, lastIndex);
  299. m_RandomSeed = Math.RandomInt(0,1023);
  300. m_ColorSequenceIndex = Math.RandomIntInclusive(0, lastIndex);
  301. }
  302. void ~FireworksLauncher()
  303. {
  304. SEffectManager.DestroyEffect(m_FuseSound);
  305. SEffectManager.DestroyEffect(m_FuseSoundStart);
  306. }
  307. override protected bool UsesGlobalDeploy()
  308. {
  309. return true;
  310. }
  311. override bool IsDeployable()
  312. {
  313. return true;
  314. }
  315. //!how long it takes to deploy this item in seconds
  316. override float GetDeployTime()
  317. {
  318. return 2;
  319. }
  320. protected void SetupColorSequences()
  321. {
  322. m_ColorSequence.Insert("RGBYPBRGBRGBYPBRGBRGBYPBRGBPBRGBRGBY");
  323. m_ColorSequence.Insert("PGPYPBYPYPBYYPBRPYPBYYPBRGBPBRGRGBRB");
  324. m_ColorSequence.Insert("YPBRPYPBYYPBRGBPBRGRGBRBGRPBRGBRYPBY");
  325. m_ColorSequence.Insert("YRBGPRYPGRYBGRGRGBRBBYPYPBYRYPGRYGRP");
  326. m_ColorSequence.Insert("BGRYPYRPBYYPYRBGPRYPGBYPBRGBPBRGBRGB");
  327. m_ColorSequence.Insert("RYGRPBRGBYPBRRPBRGBBRBBYPYPRGBRGBRPY");
  328. m_ColorSequence.Insert("GBRGBYRGBYPBRRPBRBYRYPGPYPRGBRGBRPYG");
  329. m_ColorSequence.Insert("RYPBYYPBRGBYPBRGBRBGBPBRGRGBRBGRYPYR");
  330. m_ColorSequence.Insert("PBRGBYPBRGBRBGBPBRGRGBRBGRYPYRRYPBYY");
  331. m_ColorSequence.Insert("RGRGBRBBYPYPBYRYPGRYGRPYRBGPRYPGRYBG");
  332. m_ColorSequence.Insert("RBYRYPGPYPRGBRGBRPYGGBRGBYRGBYPBRRPB");
  333. m_ColorSequence.Insert("PRGBRGBRPYGGBRRBYRYPGPYGBYRGBYPBRRPB");
  334. }
  335. string GetColorSequence()
  336. {
  337. if (m_ColorSequence.IsValidIndex(m_ColorSequenceIndex))
  338. {
  339. return m_ColorSequence.Get(m_ColorSequenceIndex);
  340. }
  341. else
  342. {
  343. ErrorEx("Failed to obtain color sequence");
  344. return "RYPBYYPBRGBYPBRGBRBGBPBRGRGBRBGRYPYR";
  345. }
  346. }
  347. override protected void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
  348. {
  349. super.OnPlacementComplete(player, position, orientation);
  350. if (GetGame().IsServer())
  351. {
  352. if (GetState() == EFireworksState.DEFAULT)
  353. {
  354. SetState(EFireworksState.PLACED);
  355. }
  356. }
  357. }
  358. override protected float GetMaxAllowedWetness()
  359. {
  360. return GameConstants.STATE_WET;
  361. }
  362. override protected float GetEventDelay()
  363. {
  364. return Math.RandomFloatInclusive(3,3.35);
  365. }
  366. protected string GetFuseSoundSet()
  367. {
  368. return "FireworksLauncher_Ignition_Loop_SoundSet";
  369. }
  370. protected int GetMaxShots()
  371. {
  372. return 16;
  373. }
  374. protected float GetFuseDelay()
  375. {
  376. return 3;
  377. }
  378. protected string GetAmmoType()
  379. {
  380. return "Fireworks_Ammo";
  381. }
  382. protected int GetDamageType()
  383. {
  384. return DamageType.EXPLOSION;
  385. }
  386. override protected void OnStateChangedServer(EFireworksState currentState)
  387. {
  388. switch (currentState)
  389. {
  390. case EFireworksState.PLACED:
  391. break
  392. case EFireworksState.IGNITED:
  393. OnFuseIgnitedServer();
  394. break
  395. case EFireworksState.FIRING:
  396. HideSelection("cover");
  397. OnFiringStartServer();
  398. break
  399. case EFireworksState.FINISHED:
  400. HideSelection("cover");//when loading from storage
  401. break
  402. default: {};
  403. }
  404. }
  405. override protected void OnStateChangedClient(EFireworksState currentState)
  406. {
  407. switch (currentState)
  408. {
  409. case EFireworksState.IGNITED:
  410. OnFuseIgnitedClient();
  411. break
  412. case EFireworksState.PLACED:
  413. break
  414. case EFireworksState.FIRING:
  415. OnFiringStartClient();
  416. break
  417. default: {};
  418. }
  419. }
  420. //! Executed on Server when some item ignited this one
  421. override void OnIgnitedThis( EntityAI fire_source)
  422. {
  423. super.OnIgnitedThis(fire_source);
  424. if (m_Events)
  425. {
  426. m_Events.Clear();
  427. }
  428. m_Index = 0;
  429. if (m_TimerEvent)
  430. {
  431. m_TimerEvent.Stop();
  432. }
  433. }
  434. override protected bool CanPutInCargo( EntityAI parent )
  435. {
  436. return (GetState() == EFireworksState.DEFAULT || (GetState() == EFireworksState.PLACED) || (GetState() == EFireworksState.FINISHED);
  437. }
  438. override protected bool CanPutIntoHands( EntityAI parent )
  439. {
  440. return (GetState() == EFireworksState.DEFAULT || (GetState() == EFireworksState.PLACED) || (GetState() == EFireworksState.FINISHED);
  441. }
  442. protected void OnFuseIgnitedServer()
  443. {
  444. int state = EFireworksState.FIRING;
  445. GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( SetState, GetFuseDelay()*1000, false, state);
  446. }
  447. protected void OnFuseIgnitedClient()
  448. {
  449. m_ParticleFuse = ParticleManager.GetInstance().PlayInWorld(ParticleList.FIREWORKS_FUSE, GetPosition() + "0 0.15 0");
  450. if (m_ParticleFuse)
  451. m_ParticleFuse.SetOwner(this);
  452. PlaySoundSet( m_FuseSoundStart, "FireworksLauncher_Ignition_Start_SoundSet", 0, 0 );
  453. vector fuseStart;
  454. vector fuseEnd;
  455. if (MemoryPointExists("Fuse_Start"))
  456. {
  457. fuseStart = GetMemoryPointPos("Fuse_Start");
  458. fuseStart = ModelToWorld(fuseStart);
  459. }
  460. if (MemoryPointExists("Fuse_End"))
  461. {
  462. fuseEnd = GetMemoryPointPos("Fuse_End");
  463. fuseEnd = ModelToWorld(fuseEnd);
  464. }
  465. vector fuseDir = fuseEnd - fuseStart;
  466. vector fuseOrientation[4];
  467. vector ori = fuseDir.VectorToAngles();
  468. m_ParticleFuse.SetOrientation(ori);
  469. m_ParticleFuse.SetPosition(fuseStart);
  470. PlaySoundSetLoop( m_FuseSound, GetFuseSoundSet(), 0, 0 );
  471. }
  472. protected void OnFiringStartServer()
  473. {
  474. OnEventServer(0);
  475. }
  476. protected void OnFiringStartClient()
  477. {
  478. if (m_ParticleFuse)
  479. {
  480. m_ParticleFuse.StopParticle(StopParticleFlags.IMMEDIATE);
  481. }
  482. if (m_FuseSound)
  483. {
  484. m_FuseSound.Stop();
  485. }
  486. }
  487. protected void OnFiringStop()
  488. {
  489. SetHealth01("","",0);
  490. }
  491. //!Starts event timer
  492. protected void RestartEventTimer()
  493. {
  494. if (!m_TimerEvent)
  495. {
  496. m_TimerEvent = new Timer();
  497. }
  498. m_TimerEvent.Run(GetEventDelay(), this, "OnEventServer", new Param1<int>(0));
  499. }
  500. override protected bool IsIgnited()
  501. {
  502. return GetState()==EFireworksState.IGNITED;
  503. }
  504. override protected bool CanIgniteItem(EntityAI ignite_target = NULL)
  505. {
  506. return false;
  507. }
  508. //!Called periodically but only after the entity gets ignited
  509. override protected void OnEventServer(int type)
  510. {
  511. m_Index++;
  512. DamageSystem.ExplosionDamage(this, NULL, GetAmmoType(), GetPosition(), GetDamageType());
  513. SetSynchDirty();
  514. if (m_Index > GetMaxShots())
  515. {
  516. m_Index = GetMaxShots();
  517. m_TimerEvent = null;
  518. SetState(EFireworksState.FINISHED);
  519. }
  520. else
  521. {
  522. RestartEventTimer();
  523. }
  524. }
  525. protected void OnIndexChangedClient()
  526. {
  527. if (!m_Events)
  528. {
  529. m_Events = new array<ref FireworksLauncherClientEventBase>;
  530. }
  531. if (m_Index != 0 && m_State == EFireworksState.FIRING)//can only be true when restarting the device during debug calls
  532. {
  533. FireworksLauncherClientEventBase fireEvent = SpawnEvent();
  534. m_Events.Insert(fireEvent);
  535. }
  536. }
  537. protected FireworksLauncherClientEventBase SpawnEvent()
  538. {
  539. FireworksLauncherClientEventBase evnt = new FireworksLauncherClientEvent(this,m_Index);
  540. evnt.OnFired();
  541. return evnt;
  542. }
  543. override protected void OnVariablesSynchronized()
  544. {
  545. super.OnVariablesSynchronized();
  546. //Print("index: " + m_Index);
  547. if (m_Index != m_IndexPrev)
  548. {
  549. Math.Randomize(m_RandomSeed+m_Index);
  550. OnIndexChangedClient();
  551. m_IndexPrev = m_Index;
  552. }
  553. }
  554. override protected void OnStoreSave(ParamsWriteContext ctx)
  555. {
  556. super.OnStoreSave(ctx);
  557. ctx.Write(m_Index);
  558. ctx.Write(m_State);
  559. }
  560. override protected bool OnStoreLoad( ParamsReadContext ctx, int version )
  561. {
  562. if (!super.OnStoreLoad(ctx, version))
  563. {
  564. return false;
  565. }
  566. if (version >= 130)
  567. {
  568. if (!ctx.Read(m_Index))
  569. {
  570. return false;
  571. }
  572. if (!ctx.Read(m_State))
  573. {
  574. return false;
  575. }
  576. SetState(m_State);
  577. }
  578. return true;
  579. }
  580. override string GetDeploySoundset()
  581. {
  582. return "placeFireworks_SoundSet";
  583. }
  584. override string GetLoopDeploySoundset()
  585. {
  586. return "fireworks_deploy_SoundSet";
  587. }
  588. #ifdef DEVELOPER
  589. override protected string GetDebugText()
  590. {
  591. string debug_output;
  592. if( GetGame().IsDedicatedServer())
  593. {
  594. debug_output+= EnumTools.EnumToString(EFireworksState, m_State) +"\n";
  595. debug_output+= "m_Index:" + m_Index +"\n";
  596. }
  597. else
  598. {
  599. }
  600. return debug_output;
  601. }
  602. #endif
  603. }