From fe35188e2c7b3f7cf209aebf7f97c184e30ae8fb Mon Sep 17 00:00:00 2001 From: lzk <124214523+lzk228@users.noreply.github.com> Date: Thu, 9 May 2024 08:33:08 +0200 Subject: [PATCH] Add auto map vote cvar (#27496) * Add auto map vote cvar * :trollface: --- Content.Server/GameTicking/GameTicker.RoundFlow.cs | 8 ++++++++ Content.Shared/CCVar/CCVars.cs | 6 ++++++ Resources/ConfigPresets/WizardsDen/wizardsDen.toml | 1 + 3 files changed, 15 insertions(+) diff --git a/Content.Server/GameTicking/GameTicker.RoundFlow.cs b/Content.Server/GameTicking/GameTicker.RoundFlow.cs index df597e69b2..d01838964a 100644 --- a/Content.Server/GameTicking/GameTicker.RoundFlow.cs +++ b/Content.Server/GameTicking/GameTicker.RoundFlow.cs @@ -4,12 +4,14 @@ using Content.Server.Discord; using Content.Server.GameTicking.Events; using Content.Server.Ghost; using Content.Server.Maps; +using Content.Server.Voting.Managers; using Content.Shared.CCVar; using Content.Shared.Database; using Content.Shared.GameTicking; using Content.Shared.Mind; using Content.Shared.Players; using Content.Shared.Preferences; +using Content.Shared.Voting; using JetBrains.Annotations; using Prometheus; using Robust.Server.Maps; @@ -27,6 +29,7 @@ namespace Content.Server.GameTicking { [Dependency] private readonly DiscordWebhook _discord = default!; [Dependency] private readonly ITaskManager _taskManager = default!; + [Dependency] private readonly IVoteManager _voteManager = default!; private static readonly Counter RoundNumberMetric = Metrics.CreateCounter( "ss14_round_number", @@ -508,6 +511,11 @@ namespace Content.Server.GameTicking SendStatusToAll(); UpdateInfoText(); + if (_configurationManager.GetCVar(CCVars.GameAutoMapVote)) + { + _voteManager.CreateStandardVote(null, StandardVoteType.Map); + } + ReqWindowAttentionAll(); } } diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 36de8857fb..c46f5fb923 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -330,6 +330,12 @@ namespace Content.Shared.CCVar public static readonly CVarDef DebugCoordinatesAdminOnly = CVarDef.Create("game.debug_coordinates_admin_only", true, CVar.SERVER | CVar.REPLICATED); + /// + /// Controls if lobby has an automatic map vote. + /// + public static readonly CVarDef + GameAutoMapVote = CVarDef.Create("game.lobby_auto_map_vote", true, CVar.ARCHIVE | CVar.SERVERONLY); + #if EXCEPTION_TOLERANCE /// /// Amount of times round start must fail before the server is shut down. diff --git a/Resources/ConfigPresets/WizardsDen/wizardsDen.toml b/Resources/ConfigPresets/WizardsDen/wizardsDen.toml index 413de472bf..a30313665e 100644 --- a/Resources/ConfigPresets/WizardsDen/wizardsDen.toml +++ b/Resources/ConfigPresets/WizardsDen/wizardsDen.toml @@ -4,6 +4,7 @@ [game] desc = "Official English Space Station 14 servers. Vanilla, low roleplay." lobbyenabled = true +lobby_auto_map_vote = false soft_max_players = 80 panic_bunker.enabled = true panic_bunker.disable_with_admins = true -- 2.51.2