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:
committed by
GitHub
parent
ed2fa96ca0
commit
5af1d0ea8b
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user