Add connect sound for gastank internals (#8318)

This commit is contained in:
metalgearsloth
2022-05-22 12:31:37 +10:00
committed by GitHub
parent 5640b047f7
commit c3fa24ccd8
4 changed files with 28 additions and 2 deletions

View File

@@ -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<SharedActionsSystem>().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<SharedActionsSystem>().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();
}

View File

@@ -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();

Binary file not shown.

View File

@@ -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