From 30ccde0a47f65d0f6b0641f5bf92d95650c4fb87 Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Fri, 1 Mar 2024 02:08:48 -0800 Subject: [PATCH] Make the round end sound collection a cvar (#25741) * Make the round end sound collection a cvar * Fix comment * Clarity --- Content.Server/GameTicking/GameTicker.CVars.cs | 4 ++++ Content.Server/GameTicking/GameTicker.RoundFlow.cs | 2 +- Content.Shared/CCVar/CCVars.cs | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Content.Server/GameTicking/GameTicker.CVars.cs b/Content.Server/GameTicking/GameTicker.CVars.cs index 6e1fda3e2d..60ffa660f5 100644 --- a/Content.Server/GameTicking/GameTicker.CVars.cs +++ b/Content.Server/GameTicking/GameTicker.CVars.cs @@ -26,6 +26,9 @@ namespace Content.Server.GameTicking private WebhookIdentifier? _webhookIdentifier; + [ViewVariables] + private string? RoundEndSoundCollection { get; set; } + #if EXCEPTION_TOLERANCE [ViewVariables] public int RoundStartFailShutdownCount { get; private set; } = 0; @@ -69,6 +72,7 @@ namespace Content.Server.GameTicking DiscordRoundEndRole = null; } }, true); + Subs.CVar(_configurationManager, CCVars.RoundEndSoundCollection, value => RoundEndSoundCollection = value, true); #if EXCEPTION_TOLERANCE Subs.CVar(_configurationManager, CCVars.RoundStartFailShutdownCount, value => RoundStartFailShutdownCount = value, true); #endif diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index ffe26aeb34..69624ed5b2 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -392,7 +392,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(); - var sound = _audio.GetSound(new SoundCollectionSpecifier("RoundEnd")); + var sound = RoundEndSoundCollection == null ? null : _audio.GetSound(new SoundCollectionSpecifier(RoundEndSoundCollection)); RaiseNetworkEvent(new RoundEndMessageEvent(gamemodeTitle, roundEndText, roundDuration, RoundId, listOfPlayerInfoFinal.Length, listOfPlayerInfoFinal, LobbySong, sound)); diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 01dc84c167..bfb7081bcb 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -369,6 +369,12 @@ namespace Content.Shared.CCVar public static readonly CVarDef SecretWeightPrototype = CVarDef.Create("game.secret_weight_prototype", "Secret", CVar.SERVERONLY); + /// + /// The id of the sound collection to randomly choose a sound from and play when the round ends. + /// + public static readonly CVarDef RoundEndSoundCollection = + CVarDef.Create("game.round_end_sound_collection", "RoundEnd", CVar.SERVERONLY); + /* * Discord */