SharedGlobalSoundSystem.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using Content.Shared.CCVar;
  2. using Robust.Shared.Audio;
  3. using Robust.Shared.Serialization;
  4. namespace Content.Shared.Audio;
  5. /// <summary>
  6. /// Handles playing audio to all players globally unless disabled by cvar. Some events are grid-specific.
  7. /// </summary>
  8. public abstract class SharedGlobalSoundSystem : EntitySystem
  9. {
  10. }
  11. [Virtual]
  12. [Serializable, NetSerializable]
  13. public class GlobalSoundEvent : EntityEventArgs
  14. {
  15. public ResolvedSoundSpecifier Specifier;
  16. public AudioParams? AudioParams;
  17. public GlobalSoundEvent(ResolvedSoundSpecifier specifier, AudioParams? audioParams = null)
  18. {
  19. Specifier = specifier;
  20. AudioParams = audioParams;
  21. }
  22. }
  23. /// <summary>
  24. /// Intended for admin music. Can be disabled by the <seealso cref="CCVars.AdminSoundsEnabled"/> cvar.
  25. /// </summary>
  26. [Serializable, NetSerializable]
  27. public sealed class AdminSoundEvent : GlobalSoundEvent
  28. {
  29. public AdminSoundEvent(ResolvedSoundSpecifier specifier, AudioParams? audioParams = null) : base(specifier, audioParams){}
  30. }
  31. /// <summary>
  32. /// Intended for misc sound effects. Can't be disabled by cvar.
  33. /// </summary>
  34. [Serializable, NetSerializable]
  35. public sealed class GameGlobalSoundEvent : GlobalSoundEvent
  36. {
  37. public GameGlobalSoundEvent(ResolvedSoundSpecifier specifier, AudioParams? audioParams = null) : base(specifier, audioParams){}
  38. }
  39. public enum StationEventMusicType : byte
  40. {
  41. Nuke
  42. }
  43. /// <summary>
  44. /// Intended for music triggered by events on a specific station. Can be disabled by the <seealso cref="CCVars.EventMusicEnabled"/> cvar.
  45. /// </summary>
  46. [Serializable, NetSerializable]
  47. public sealed class StationEventMusicEvent : GlobalSoundEvent
  48. {
  49. public StationEventMusicType Type;
  50. public StationEventMusicEvent(ResolvedSoundSpecifier specifier, StationEventMusicType type, AudioParams? audioParams = null) : base(
  51. specifier, audioParams)
  52. {
  53. Type = type;
  54. }
  55. }
  56. /// <summary>
  57. /// Attempts to stop a playing <seealso cref="StationEventMusicEvent"/> stream.
  58. /// </summary>
  59. [Serializable, NetSerializable]
  60. public sealed class StopStationEventMusic : EntityEventArgs
  61. {
  62. public StationEventMusicType Type;
  63. public StopStationEventMusic(StationEventMusicType type)
  64. {
  65. Type = type;
  66. }
  67. }