change the restart vote to have no effect with admins online (#22945)
* Change the vote and cvar * Only denies successful votes * Add comments because I'm a good coder, I swear * I added a space to the first line of ccvars it's so over
This commit is contained in:
@@ -80,12 +80,20 @@ namespace Content.Server.Voting.Managers
|
||||
|
||||
var ratioRequired = _cfg.GetCVar(CCVars.VoteRestartRequiredRatio);
|
||||
if (total > 0 && votesYes / (float) total >= ratioRequired)
|
||||
{
|
||||
// Check if an admin is online, and ignore the passed vote if the cvar is enabled
|
||||
if (_cfg.GetCVar(CCVars.VoteRestartNotAllowedWhenAdminOnline) && _adminMgr.ActiveAdmins.Count() != 0)
|
||||
{
|
||||
_adminLogger.Add(LogType.Vote, LogImpact.Medium, $"Restart vote attempted to pass, but an admin was online. {votesYes}/{votesNo}");
|
||||
}
|
||||
else // If the cvar is disabled or there's no admins on, proceed as normal
|
||||
{
|
||||
_adminLogger.Add(LogType.Vote, LogImpact.Medium, $"Restart vote succeeded: {votesYes}/{votesNo}");
|
||||
_chatManager.DispatchServerAnnouncement(Loc.GetString("ui-vote-restart-succeeded"));
|
||||
var roundEnd = _entityManager.EntitySysManager.GetEntitySystem<RoundEndSystem>();
|
||||
roundEnd.EndRound();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_adminLogger.Add(LogType.Vote, LogImpact.Medium, $"Restart vote failed: {votesYes}/{votesNo}");
|
||||
|
||||
@@ -338,10 +338,6 @@ 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;
|
||||
|
||||
// If only one Preset available thats not really a vote
|
||||
// Still allow vote if availbable one is different from current one
|
||||
if (voteType == StandardVoteType.Preset)
|
||||
|
||||
@@ -1223,7 +1223,7 @@ namespace Content.Shared.CCVar
|
||||
CVarDef.Create("vote.restart_required_ratio", 0.85f, CVar.SERVERONLY);
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not to restrict the restart vote when there's online admins.
|
||||
/// Whether or not to prevent the restart vote from having any effect when there is an online admin
|
||||
/// </summary>
|
||||
public static readonly CVarDef<bool> VoteRestartNotAllowedWhenAdminOnline =
|
||||
CVarDef.Create("vote.restart_not_allowed_when_admin_online", true, CVar.SERVERONLY);
|
||||
|
||||
Reference in New Issue
Block a user