diff --git a/Content.Server/Atmos/Components/GasTankComponent.cs b/Content.Server/Atmos/Components/GasTankComponent.cs index 6f3f67f496..012c9cd3f1 100644 --- a/Content.Server/Atmos/Components/GasTankComponent.cs +++ b/Content.Server/Atmos/Components/GasTankComponent.cs @@ -29,7 +29,21 @@ namespace Content.Server.Atmos.Components [ViewVariables] public BoundUserInterface? UserInterface; - [DataField("ruptureSound")] private SoundSpecifier _ruptureSound = new SoundPathSpecifier("Audio/Effects/spray.ogg"); + [ViewVariables(VVAccess.ReadWrite), DataField("ruptureSound")] private SoundSpecifier _ruptureSound = new SoundPathSpecifier("/Audio/Effects/spray.ogg"); + + [ViewVariables(VVAccess.ReadWrite), DataField("connectSound")] private SoundSpecifier? _connectSound = + new SoundPathSpecifier("/Audio/Effects/internals.ogg") + { + Params = AudioParams.Default.WithVolume(10f), + }; + + [ViewVariables(VVAccess.ReadWrite), DataField("disconnectSound")] private SoundSpecifier? _disconnectSound; + + // Cancel toggles sounds if we re-toggle again. + + private IPlayingAudioStream? _connectStream; + private IPlayingAudioStream? _disconnectStream; + [DataField("air")] [ViewVariables] public GasMixture Air { get; set; } = new(); @@ -131,6 +145,11 @@ namespace Content.Server.Atmos.Components if (internals == null) return; IsConnected = internals.TryConnectTank(Owner); EntitySystem.Get().SetToggled(ToggleAction, IsConnected); + _connectStream?.Stop(); + + if (_connectSound != null) + _connectStream = SoundSystem.Play(Filter.Pvs(Owner, entityManager: _entMan), _connectSound.GetSound(), Owner, _connectSound.Params); + UpdateUserInterface(); } @@ -140,6 +159,11 @@ namespace Content.Server.Atmos.Components IsConnected = false; EntitySystem.Get().SetToggled(ToggleAction, false); GetInternalsComponent(owner)?.DisconnectTank(); + _disconnectStream?.Stop(); + + if (_disconnectSound != null) + _disconnectStream = SoundSystem.Play(Filter.Pvs(Owner, entityManager: _entMan), _disconnectSound.GetSound(), Owner, _disconnectSound.Params); + UpdateUserInterface(); } diff --git a/Content.Shared/Sound/SoundSpecifier.cs b/Content.Shared/Sound/SoundSpecifier.cs index 3996c5e960..f5962ecd03 100644 --- a/Content.Shared/Sound/SoundSpecifier.cs +++ b/Content.Shared/Sound/SoundSpecifier.cs @@ -10,7 +10,7 @@ namespace Content.Shared.Sound [ImplicitDataDefinitionForInheritors] public abstract class SoundSpecifier { - [DataField("params")] + [ViewVariables(VVAccess.ReadWrite), DataField("params")] public AudioParams Params = AudioParams.Default; public abstract string GetSound(); diff --git a/Resources/Audio/Effects/internals.ogg b/Resources/Audio/Effects/internals.ogg new file mode 100644 index 0000000000..eaa93e20fc Binary files /dev/null and b/Resources/Audio/Effects/internals.ogg differ diff --git a/Resources/Audio/Effects/licenses.txt b/Resources/Audio/Effects/licenses.txt index ce352cf03d..6ddb5dc5e7 100644 --- a/Resources/Audio/Effects/licenses.txt +++ b/Resources/Audio/Effects/licenses.txt @@ -13,6 +13,8 @@ holy.ogg taken from https://freesound.org/people/random_intruder/sounds/392172/ hug.ogg taken from /tg/station at https://github.com/tgstation/tgstation/blob/e6624ac8aed150668bb4e61c3a48372cc757bfd4/sound/weapons/thudswoosh.ogg - Under license: CC BY-SA 3.0 +internals.ogg taken from CEV-Eris at https://github.com/discordia-space/CEV-Eris/blob/f02a6e2c29b41c28b1cf4d8f897cb8f090f43552/sound/effects/internals.ogg - Under license: CC BY-SA 3.0. Edited by metalgearsloth to amplify the volume + poster_broken.ogg taken from https://github.com/tgstation/tgstation/blob/2834383245d2129a106acef3afd17b81e1e64777/sound/items/poster_ripped.ogg poster_being_set.ogg taken from https://github.com/tgstation/tgstation/blob/2834383245d2129a106acef3afd17b81e1e64777/sound/items/poster_ripped.ogg