using Robust.Shared.Audio; using Robust.Shared.ComponentTrees; using Robust.Shared.GameStates; using Robust.Shared.Physics; using Robust.Shared.Serialization; namespace Content.Shared.Audio; [RegisterComponent] [NetworkedComponent] [Access(typeof(SharedAmbientSoundSystem))] public sealed class AmbientSoundComponent : Component, IComponentTreeEntry { [DataField("enabled")] [ViewVariables(VVAccess.ReadWrite)] // only for map editing public bool Enabled { get; set; } = true; [DataField("sound", required: true), ViewVariables(VVAccess.ReadWrite)] // only for map editing public SoundSpecifier Sound = default!; /// /// How far away this ambient sound can potentially be heard. /// [ViewVariables(VVAccess.ReadWrite)] // only for map editing [DataField("range")] public float Range = 2f; /// /// Applies this volume to the sound being played. /// [ViewVariables(VVAccess.ReadWrite)] // only for map editing [DataField("volume")] public float Volume = -10f; public EntityUid? TreeUid { get; set; } public DynamicTree>? Tree { get; set; } public bool AddToTree => Enabled; public bool TreeUpdateQueued { get; set; } } [Serializable, NetSerializable] public sealed class AmbientSoundComponentState : ComponentState { public bool Enabled { get; init; } public float Range { get; init; } public float Volume { get; init; } }