grenade_chemgas.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. class Grenade_ChemGas : Grenade_Base
  2. {
  3. protected bool m_Exploded;
  4. protected ParticleSource m_ParticleExploded;
  5. protected EffectSound m_ExplosionSound;
  6. void Grenade_ChemGas()
  7. {
  8. SetParticleExplosion(ParticleList.RGD5);
  9. SetGrenadeType(EGrenadeType.CHEMICAL);
  10. m_Pinned = false;
  11. SetPinnable(false);
  12. Arm();
  13. }
  14. void ~Grenade_ChemGas();
  15. override protected void OnExplode()
  16. {
  17. m_Exploded = true;
  18. if (GetGame().IsServer())
  19. {
  20. GetGame().CreateObject("ContaminatedArea_Local", GetPosition());
  21. }
  22. }
  23. protected string GetExplosionSoundSet()
  24. {
  25. return "Grenade_detonation_SoundSet";
  26. }
  27. override void EOnContact(IEntity other, Contact extra)
  28. {
  29. if (GetGame().IsServer())
  30. {
  31. if (!m_Exploded)
  32. {
  33. OnActivateFinished();
  34. }
  35. }
  36. }
  37. override void EEKilled(Object killer)
  38. {
  39. super.EEKilled(killer);
  40. }
  41. override void OnDamageDestroyed(int oldLevel)
  42. {
  43. if (GetGame().IsServer() || !GetGame().IsMultiplayer())
  44. {
  45. GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(Delete, 1000);
  46. }
  47. #ifndef SERVER
  48. ClearFlags(EntityFlags.VISIBLE, false);
  49. m_ParticleExploded = ParticleManager.GetInstance().PlayInWorld(ParticleList.GRENADE_CHEM_BREAK, GetPosition());
  50. PlaySoundSet( m_ExplosionSound, GetExplosionSoundSet(), 0, 0 );
  51. #endif
  52. }
  53. override protected void Activate()
  54. {
  55. //we don't want base functionality here
  56. }
  57. }