]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add auto map vote cvar (#27496)
authorlzk <124214523+lzk228@users.noreply.github.com>
Thu, 9 May 2024 06:33:08 +0000 (08:33 +0200)
committerGitHub <noreply@github.com>
Thu, 9 May 2024 06:33:08 +0000 (23:33 -0700)
* Add auto map vote cvar

* :trollface:

Content.Server/GameTicking/GameTicker.RoundFlow.cs
Content.Shared/CCVar/CCVars.cs
Resources/ConfigPresets/WizardsDen/wizardsDen.toml

index df597e69b2fa5b26c609905db35e7759451e84f4..d01838964a4bd4f9ce2f024547ac8f8df29e13fe 100644 (file)
@@ -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();
             }
         }
index 36de8857fb146347d3b9a55acc000463b50bbf0b..c46f5fb923d8d0c37ec1a310078daa1a8b975a6e 100644 (file)
@@ -330,6 +330,12 @@ namespace Content.Shared.CCVar
         public static readonly CVarDef<bool> DebugCoordinatesAdminOnly =
             CVarDef.Create("game.debug_coordinates_admin_only", true, CVar.SERVER | CVar.REPLICATED);
 
+        /// <summary>
+        ///     Controls if lobby has an automatic map vote.
+        /// </summary>
+        public static readonly CVarDef<bool>
+            GameAutoMapVote = CVarDef.Create("game.lobby_auto_map_vote", true, CVar.ARCHIVE | CVar.SERVERONLY);
+
 #if EXCEPTION_TOLERANCE
         /// <summary>
         ///     Amount of times round start must fail before the server is shut down.
index 413de472bf9e4f6ec67cbc84663cfb81fa707178..a30313665e9c33f7a776c089dc03a9d60314da6f 100644 (file)
@@ -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