Ambient sound system (#4552)
* Ambient sound system Client-side system that plays audio from nearby objects that are randomly sampled. * Decent * Tweaks * Tweaks * Comment this out for now * reduce VM sound * Fix rolloff * Fixes * Volume tweak
This commit is contained in:
46
Content.Shared/Audio/AmbientSoundComponent.cs
Normal file
46
Content.Shared/Audio/AmbientSoundComponent.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
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
|
||||
{
|
||||
public override string Name => "AmbientSound";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("enabled")]
|
||||
public bool Enabled { get; set; } = true;
|
||||
|
||||
[DataField("sound")]
|
||||
public SoundSpecifier Sound = default!;
|
||||
|
||||
/// <summary>
|
||||
/// How far away this ambient sound can potentially be heard.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("range")]
|
||||
public float Range = 2f;
|
||||
|
||||
/// <summary>
|
||||
/// Applies this volume to the sound being played.
|
||||
/// </summary>
|
||||
[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; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user