Fixes round restart audio clipping (#24044)

* Fix round end audio clipping

* weh

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Hannah Giovanna Dawson
2024-01-20 03:40:00 +00:00
committed by GitHub
parent ed2fa96ca0
commit 5af1d0ea8b
4 changed files with 32 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
using Content.Client.GameTicking.Managers;
using Content.Client.Lobby;
using Content.Shared.CCVar;
using Content.Shared.GameTicking;
using JetBrains.Annotations;
using Robust.Client;
using Robust.Client.State;
@@ -39,6 +40,8 @@ public sealed class BackgroundAudioSystem : EntitySystem
_client.PlayerLeaveServer += OnLeave;
_gameTicker.LobbySongUpdated += LobbySongUpdated;
SubscribeNetworkEvent<RoundRestartCleanupEvent>(PlayRestartSound);
}
public override void Shutdown()
@@ -129,4 +132,22 @@ public sealed class BackgroundAudioSystem : EntitySystem
{
LobbyStream = _audio.Stop(LobbyStream);
}
private void PlayRestartSound(RoundRestartCleanupEvent ev)
{
if (!_configManager.GetCVar(CCVars.LobbyMusicEnabled))
return;
var file = _gameTicker.RestartSound;
if (string.IsNullOrEmpty(file))
{
return;
}
var volume = _lobbyParams.WithVolume(_lobbyParams.Volume +
SharedAudioSystem.GainToVolume(
_configManager.GetCVar(CCVars.LobbyMusicVolume)));
_audio.PlayGlobal(file, Filter.Local(), false, volume);
}
}