1
0

SpamEmitSoundComponent.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using Robust.Shared.GameStates;
  2. namespace Content.Shared.Sound.Components;
  3. /// <summary>
  4. /// Repeatedly plays a sound with a randomized delay.
  5. /// </summary>
  6. [RegisterComponent, NetworkedComponent]
  7. [AutoGenerateComponentState, AutoGenerateComponentPause]
  8. public sealed partial class SpamEmitSoundComponent : BaseEmitSoundComponent
  9. {
  10. /// <summary>
  11. /// The time at which the next sound will play.
  12. /// </summary>
  13. [DataField, AutoPausedField, AutoNetworkedField]
  14. public TimeSpan NextSound;
  15. /// <summary>
  16. /// The minimum time in seconds between playing the sound.
  17. /// </summary>
  18. [DataField]
  19. public TimeSpan MinInterval = TimeSpan.FromSeconds(2);
  20. /// <summary>
  21. /// The maximum time in seconds between playing the sound.
  22. /// </summary>
  23. [DataField]
  24. public TimeSpan MaxInterval = TimeSpan.FromSeconds(2);
  25. // Always Pvs.
  26. /// <summary>
  27. /// Content of a popup message to display whenever the sound plays.
  28. /// </summary>
  29. [DataField]
  30. public LocId? PopUp;
  31. /// <summary>
  32. /// Whether the timer is currently running and sounds are being played.
  33. /// Do not set this directly, use <see cref="EmitSoundSystem.SetEnabled"/>
  34. /// </summary>
  35. [DataField, AutoNetworkedField]
  36. [Access(typeof(SharedEmitSoundSystem))]
  37. public bool Enabled = true;
  38. }