Add connect sound for gastank internals (#8318)
This commit is contained in:
@@ -29,7 +29,21 @@ namespace Content.Server.Atmos.Components
|
|||||||
|
|
||||||
[ViewVariables] public BoundUserInterface? UserInterface;
|
[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();
|
[DataField("air")] [ViewVariables] public GasMixture Air { get; set; } = new();
|
||||||
|
|
||||||
@@ -131,6 +145,11 @@ namespace Content.Server.Atmos.Components
|
|||||||
if (internals == null) return;
|
if (internals == null) return;
|
||||||
IsConnected = internals.TryConnectTank(Owner);
|
IsConnected = internals.TryConnectTank(Owner);
|
||||||
EntitySystem.Get<SharedActionsSystem>().SetToggled(ToggleAction, IsConnected);
|
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();
|
UpdateUserInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,6 +159,11 @@ namespace Content.Server.Atmos.Components
|
|||||||
IsConnected = false;
|
IsConnected = false;
|
||||||
EntitySystem.Get<SharedActionsSystem>().SetToggled(ToggleAction, false);
|
EntitySystem.Get<SharedActionsSystem>().SetToggled(ToggleAction, false);
|
||||||
GetInternalsComponent(owner)?.DisconnectTank();
|
GetInternalsComponent(owner)?.DisconnectTank();
|
||||||
|
_disconnectStream?.Stop();
|
||||||
|
|
||||||
|
if (_disconnectSound != null)
|
||||||
|
_disconnectStream = SoundSystem.Play(Filter.Pvs(Owner, entityManager: _entMan), _disconnectSound.GetSound(), Owner, _disconnectSound.Params);
|
||||||
|
|
||||||
UpdateUserInterface();
|
UpdateUserInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Content.Shared.Sound
|
|||||||
[ImplicitDataDefinitionForInheritors]
|
[ImplicitDataDefinitionForInheritors]
|
||||||
public abstract class SoundSpecifier
|
public abstract class SoundSpecifier
|
||||||
{
|
{
|
||||||
[DataField("params")]
|
[ViewVariables(VVAccess.ReadWrite), DataField("params")]
|
||||||
public AudioParams Params = AudioParams.Default;
|
public AudioParams Params = AudioParams.Default;
|
||||||
|
|
||||||
public abstract string GetSound();
|
public abstract string GetSound();
|
||||||
|
|||||||
BIN
Resources/Audio/Effects/internals.ogg
Normal file
BIN
Resources/Audio/Effects/internals.ogg
Normal file
Binary file not shown.
@@ -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
|
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_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
|
poster_being_set.ogg taken from https://github.com/tgstation/tgstation/blob/2834383245d2129a106acef3afd17b81e1e64777/sound/items/poster_ripped.ogg
|
||||||
|
|||||||
Reference in New Issue
Block a user