using System;
using Content.Shared.Sound;
using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Shared.Audio
{
[RegisterComponent]
[NetworkedComponent]
public sealed class AmbientSoundComponent : Component
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("enabled")]
public bool Enabled { get; set; } = true;
[DataField("sound", required: true)]
public SoundSpecifier Sound = default!;
///
/// How far away this ambient sound can potentially be heard.
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("range")]
public float Range = 2f;
///
/// Applies this volume to the sound being played.
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("volume")]
public float Volume = -10f;
}
[Serializable, NetSerializable]
public sealed class AmbientSoundComponentState : ComponentState
{
public bool Enabled { get; init; }
public float Range { get; init; }
public float Volume { get; init; }
}
}