Files
tbd-station-14/Content.Shared/Sound/Components/SpamEmitSoundComponent.cs
Tayrtahn b1ba6b5bb6 Arcade machine improvements (#24200)
* Give 'em something to talk about

* Wire panel visuals

* Wire graphics tweak

* More ads and thanks

* More ads for a noisy arcade

* New screen for space villain machines

* Implement EmitSoundIntervalComponent and a bunch of arcade noises

* Require power for sounds

* Allow earlier startup intervals

* Orange glow

* Audio attributions

* Include the PR link

* Replace EmitSoundInterval with expanded SpamEmitSound

* Remove pacman-themed arcade sounds

* Documentation good.

* Updated methods to use Entity<T>

* Refactored SpamEmitSound to get rid of accumulator and chance.

* Fixed prewarm logic

* Moved stuff to Shared

* Fix outdated YAML

* Better prediction, auto pause handling

* Make enable/disable reset the timer instead of trying to save it.
2024-03-28 17:28:45 +11:00

45 lines
1.3 KiB
C#

using Robust.Shared.GameStates;
namespace Content.Shared.Sound.Components;
/// <summary>
/// Repeatedly plays a sound with a randomized delay.
/// </summary>
[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentState, AutoGenerateComponentPause]
public sealed partial class SpamEmitSoundComponent : BaseEmitSoundComponent
{
/// <summary>
/// The time at which the next sound will play.
/// </summary>
[DataField, AutoPausedField, AutoNetworkedField]
public TimeSpan NextSound;
/// <summary>
/// The minimum time in seconds between playing the sound.
/// </summary>
[DataField]
public TimeSpan MinInterval = TimeSpan.FromSeconds(2);
/// <summary>
/// The maximum time in seconds between playing the sound.
/// </summary>
[DataField]
public TimeSpan MaxInterval = TimeSpan.FromSeconds(2);
// Always Pvs.
/// <summary>
/// Content of a popup message to display whenever the sound plays.
/// </summary>
[DataField]
public LocId? PopUp;
/// <summary>
/// Whether the timer is currently running and sounds are being played.
/// Do not set this directly, use <see cref="EmitSoundSystem.SetEnabled"/>
/// </summary>
[DataField, AutoNetworkedField]
[Access(typeof(SharedEmitSoundSystem))]
public bool Enabled = true;
}