* 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
47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
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; }
|
|
}
|
|
}
|