From efdc3bc7e07f5740ec38319c278fa97d17fc2ae1 Mon Sep 17 00:00:00 2001 From: Moony Date: Fri, 1 Jul 2022 02:52:20 -0500 Subject: [PATCH] Gimps the restart vote. (#9327) * Disables the restart vote when admins are online. * Gimps the restart vote so it requires 85% agreement. * address rebiew --- Content.Server/Voting/Managers/VoteManager.cs | 4 ++++ Content.Shared/CCVar/CCVars.cs | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Content.Server/Voting/Managers/VoteManager.cs b/Content.Server/Voting/Managers/VoteManager.cs index e188f26dbc..ba5c9b4bad 100644 --- a/Content.Server/Voting/Managers/VoteManager.cs +++ b/Content.Server/Voting/Managers/VoteManager.cs @@ -322,6 +322,10 @@ namespace Content.Server.Voting.Managers if (voteType != null && _standardVoteTimeout.TryGetValue(voteType.Value, out timeSpan)) return false; + // No, seriously, stop spamming the restart vote! + if (voteType == StandardVoteType.Restart && _cfg.GetCVar(CCVars.VoteRestartNotAllowedWhenAdminOnline) && _adminMgr.ActiveAdmins.Count() != 0) + return false; + return !_voteTimeout.TryGetValue(initiator.UserId, out timeSpan); } diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 3d52361f53..9bfb461194 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -839,8 +839,14 @@ namespace Content.Shared.CCVar /// The required ratio of the server that must agree for a restart round vote to go through. /// public static readonly CVarDef VoteRestartRequiredRatio = - CVarDef.Create("vote.restart_required_ratio", 0.7f, CVar.SERVERONLY); + CVarDef.Create("vote.restart_required_ratio", 0.85f, CVar.SERVERONLY); + /// + /// Whether or not to restrict the restart vote when there's online admins. + /// + public static readonly CVarDef VoteRestartNotAllowedWhenAdminOnline = + CVarDef.Create("vote.restart_not_allowed_when_admin_online", true, CVar.SERVERONLY); + /// /// The delay which two votes of the same type are allowed to be made by separate people, in seconds. ///