using Content.Shared.Beeper.Systems;
using Content.Shared.FixedPoint;
using Content.Shared.ProximityDetection.Systems;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
namespace Content.Shared.Beeper.Components;
///
/// This is used for an item that beeps based on
/// proximity to a specified component.
///
[RegisterComponent, NetworkedComponent, Access(typeof(BeeperSystem)), AutoGenerateComponentState]
public sealed partial class BeeperComponent : Component
{
///
/// Whether or not it's on.
///
[DataField("enabled")]
public bool Enabled = true;
///
/// How much to scale the interval by (< 0 = min, > 1 = max)
///
[DataField("intervalScaling"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public FixedPoint2 IntervalScaling = 0;
///
/// The maximum interval between beeps.
///
[DataField("maxBeepInterval"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public TimeSpan MaxBeepInterval = TimeSpan.FromSeconds(1.5f);
///
/// The minimum interval between beeps.
///
[DataField("minBeepInterval"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public TimeSpan MinBeepInterval = TimeSpan.FromSeconds(0.25f);
///
/// Interval for the next beep
///
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan Interval;
///
/// Time when we beeped last
///
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan LastBeepTime;
[ViewVariables(VVAccess.ReadOnly)]
public TimeSpan NextBeep => LastBeepTime == TimeSpan.MaxValue ? TimeSpan.MaxValue : LastBeepTime + Interval;
///
/// Is the beep muted
///
[DataField("muted"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public bool IsMuted = false;
///
/// The sound played when the locator beeps.
///
[DataField("beepSound"), ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public SoundSpecifier? BeepSound;
}