diff --git a/Content.Client/Audio/BackgroundAudioSystem.cs b/Content.Client/Audio/BackgroundAudioSystem.cs index 2d946f0367..7a308de4a9 100644 --- a/Content.Client/Audio/BackgroundAudioSystem.cs +++ b/Content.Client/Audio/BackgroundAudioSystem.cs @@ -70,15 +70,18 @@ namespace Content.Client.Audio private void StateManagerOnStateChanged(StateChangedEventArgs args) { EndAmbience(); - EndLobbyMusic(); + if (args.NewState is LobbyState && _configManager.GetCVar(CCVars.LobbyMusicEnabled)) { StartLobbyMusic(); + return; } else if (args.NewState is GameScreen) { StartAmbience(); } + + EndLobbyMusic(); } private void OnJoin(object? sender, PlayerEventArgs args) @@ -156,9 +159,17 @@ namespace Content.Client.Audio StartLobbyMusic(); } } - private void StartLobbyMusic() + + public void RestartLobbyMusic() { EndLobbyMusic(); + StartLobbyMusic(); + } + + public void StartLobbyMusic() + { + if (_lobbyStream != null) return; + var file = _gameTicker.LobbySong; if (file == null) // We have not received the lobby song yet. { diff --git a/Content.Client/GameTicking/Managers/ClientGameTicker.cs b/Content.Client/GameTicking/Managers/ClientGameTicker.cs index 96b5b8f925..ce478faf3d 100644 --- a/Content.Client/GameTicking/Managers/ClientGameTicker.cs +++ b/Content.Client/GameTicking/Managers/ClientGameTicker.cs @@ -1,3 +1,4 @@ +using Content.Client.Audio; using Content.Client.Lobby; using Content.Client.RoundEnd; using Content.Client.Viewport; @@ -121,6 +122,12 @@ namespace Content.Client.GameTicking.Managers private void RoundEnd(RoundEndMessageEvent message) { + if (message.LobbySong != null) + { + LobbySong = message.LobbySong; + Get().StartLobbyMusic(); + } + //This is not ideal at all, but I don't see an immediately better fit anywhere else. var roundEnd = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo); } diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index 39d677562c..2c6b834955 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -326,7 +326,7 @@ namespace Content.Server.GameTicking // This ordering mechanism isn't great (no ordering of minds) but functions var listOfPlayerInfoFinal = listOfPlayerInfo.OrderBy(pi => pi.PlayerOOCName).ToArray(); _playersInGame.Clear(); - RaiseNetworkEvent(new RoundEndMessageEvent(gamemodeTitle, roundEndText, roundDuration, RoundId, listOfPlayerInfoFinal.Length, listOfPlayerInfoFinal)); + RaiseNetworkEvent(new RoundEndMessageEvent(gamemodeTitle, roundEndText, roundDuration, RoundId, listOfPlayerInfoFinal.Length, listOfPlayerInfoFinal, LobbySong)); } public void RestartRound() @@ -351,6 +351,7 @@ namespace Content.Server.GameTicking LobbySong = _robustRandom.Pick(_lobbyMusicCollection.PickFiles).ToString(); RandomizeLobbyBackground(); ResettingCleanup(); + SoundSystem.Play(Filter.Broadcast(), new SoundCollectionSpecifier("RoundEnd").GetSound()); if (!LobbyEnabled) { diff --git a/Content.Shared/GameTicking/SharedGameTicker.cs b/Content.Shared/GameTicking/SharedGameTicker.cs index b1edb44382..a18036d038 100644 --- a/Content.Shared/GameTicking/SharedGameTicker.cs +++ b/Content.Shared/GameTicking/SharedGameTicker.cs @@ -138,9 +138,16 @@ namespace Content.Shared.GameTicking public int RoundId { get; } public int PlayerCount { get; } public RoundEndPlayerInfo[] AllPlayersEndInfo { get; } + public string? LobbySong; - public RoundEndMessageEvent(string gamemodeTitle, string roundEndText, TimeSpan roundDuration, int roundId, - int playerCount, RoundEndPlayerInfo[] allPlayersEndInfo) + public RoundEndMessageEvent( + string gamemodeTitle, + string roundEndText, + TimeSpan roundDuration, + int roundId, + int playerCount, + RoundEndPlayerInfo[] allPlayersEndInfo, + string? lobbySong) { GamemodeTitle = gamemodeTitle; RoundEndText = roundEndText; @@ -148,6 +155,7 @@ namespace Content.Shared.GameTicking RoundId = roundId; PlayerCount = playerCount; AllPlayersEndInfo = allPlayersEndInfo; + LobbySong = lobbySong; } } diff --git a/Resources/Audio/Announcements/RoundEnd/apc_destroyed.ogg b/Resources/Audio/Announcements/RoundEnd/apc_destroyed.ogg new file mode 100644 index 0000000000..7fe77dd523 Binary files /dev/null and b/Resources/Audio/Announcements/RoundEnd/apc_destroyed.ogg differ diff --git a/Resources/Audio/Announcements/RoundEnd/bangin_donk.ogg b/Resources/Audio/Announcements/RoundEnd/bangin_donk.ogg new file mode 100644 index 0000000000..b3a3624de5 Binary files /dev/null and b/Resources/Audio/Announcements/RoundEnd/bangin_donk.ogg differ diff --git a/Resources/Audio/Announcements/RoundEnd/license.txt b/Resources/Audio/Announcements/RoundEnd/license.txt new file mode 100644 index 0000000000..62f15018b2 --- /dev/null +++ b/Resources/Audio/Announcements/RoundEnd/license.txt @@ -0,0 +1,3 @@ +apc_destroyed.ogg taken from https://github.com/tgstation/tgstation/commit/40d89d11ea4a5cb81d61dc1018b46f4e7d32c62a used under CC-BY-SA-3.0 +bangin_donk.ogg taken from /tg/station at commit https://github.com/tgstation/tgstation/commit/40d89d11ea4a5cb81d61dc1018b46f4e7d32c62a used under CC-BY-SA-3.0 + diff --git a/Resources/Prototypes/SoundCollections/announcements.yml b/Resources/Prototypes/SoundCollections/announcements.yml new file mode 100644 index 0000000000..f4433f76ef --- /dev/null +++ b/Resources/Prototypes/SoundCollections/announcements.yml @@ -0,0 +1,5 @@ +- type: soundCollection + id: RoundEnd + files: + - /Audio/Announcements/RoundEnd/apc_destroyed.ogg + - /Audio/Announcements/RoundEnd/bangin_donk.ogg