land_radio_panelpas.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. class Land_Radio_PanelPAS extends PASBroadcaster
  2. {
  3. //Sounds
  4. const string SOUND_PAS_TURN_ON = "pastransmitter_turnon_SoundSet";
  5. const string SOUND_PAS_TURN_OFF = "pastransmitter_turnoff_SoundSet";
  6. const string SOUND_PAS_TURNED_ON = "pastransmitter_staticnoise_SoundSet";
  7. protected EffectSound m_Sound;
  8. protected EffectSound m_SoundLoop;
  9. //--- BASE
  10. override bool IsStaticTransmitter()
  11. {
  12. return true;
  13. }
  14. override bool DisableVicinityIcon()
  15. {
  16. return true;
  17. }
  18. //--- POWER EVENTS
  19. override void OnSwitchOn()
  20. {
  21. super.OnSwitchOn();
  22. if ( !GetCompEM().CanWork() )
  23. {
  24. GetCompEM().SwitchOff();
  25. }
  26. //sound
  27. SoundTurnOn();
  28. }
  29. override void OnSwitchOff()
  30. {
  31. super.OnSwitchOff();
  32. //sound
  33. SoundTurnOff();
  34. }
  35. override void OnWorkStart()
  36. {
  37. super.OnWorkStart();
  38. //turn off device
  39. SwitchOn ( true ); // start send/receive voice
  40. //sound
  41. SoundTurnedOnNoiseStart();
  42. }
  43. override void OnWorkStop()
  44. {
  45. super.OnWorkStop();
  46. //turn off device
  47. SwitchOn ( false ); // stop send/receive voice
  48. //sound
  49. SoundTurnedOnNoiseStop();
  50. }
  51. //================================================================
  52. // SOUNDS
  53. //================================================================
  54. //Static noise when the radio is turned on
  55. protected void SoundTurnedOnNoiseStart()
  56. {
  57. PlaySoundSetLoop( m_SoundLoop, SOUND_PAS_TURNED_ON, 1.0, 1.0 );
  58. }
  59. protected void SoundTurnedOnNoiseStop()
  60. {
  61. StopSoundSet( m_SoundLoop );
  62. }
  63. protected void SoundTurnOn()
  64. {
  65. PlaySoundSet( m_Sound, SOUND_PAS_TURN_ON, 0, 0 );
  66. }
  67. protected void SoundTurnOff()
  68. {
  69. PlaySoundSet( m_Sound, SOUND_PAS_TURN_OFF, 0, 0 );
  70. }
  71. }