From bb09d0ddc42752857c18eeef46e6b827faa06571 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 16 May 2022 13:33:14 +1000 Subject: [PATCH] Restart vote is now actually passable (#8194) --- .../Managers/VoteManager.DefaultVotes.cs | 19 ++++++++++--------- Content.Server/Voting/Managers/VoteManager.cs | 1 - Content.Shared/CCVar/CCVars.cs | 4 ++-- .../en-US/voting/managers/vote-manager.ftl | 1 + 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs b/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs index 472e36d811..a320b6c02b 100644 --- a/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs +++ b/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs @@ -49,13 +49,14 @@ namespace Content.Server.Voting.Managers Title = Loc.GetString("ui-vote-restart-title"), Options = { - (Loc.GetString("ui-vote-restart-yes"), true), - (Loc.GetString("ui-vote-restart-no"), false) + (Loc.GetString("ui-vote-restart-yes"), "yes"), + (Loc.GetString("ui-vote-restart-no"), "no"), + (Loc.GetString("ui-vote-restart-abstain"), "abstain") }, Duration = alone ? TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteTimerAlone)) : TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteTimerRestart)), - InitiatorTimeout = TimeSpan.FromMinutes(3) + InitiatorTimeout = TimeSpan.FromMinutes(5) }; if (alone) @@ -67,12 +68,12 @@ namespace Content.Server.Voting.Managers vote.OnFinished += (_, _) => { - var votesYes = vote.VotesPerOption[true]; - var votesNo = vote.VotesPerOption[false]; + var votesYes = vote.VotesPerOption["yes"]; + var votesNo = vote.VotesPerOption["no"]; var total = votesYes + votesNo; var ratioRequired = _cfg.GetCVar(CCVars.VoteRestartRequiredRatio); - if (votesYes / (float) total >= ratioRequired) + if (total > 0 && votesYes / (float) total >= ratioRequired) { _chatManager.DispatchServerAnnouncement(Loc.GetString("ui-vote-restart-succeeded")); EntitySystem.Get().EndRound(); @@ -92,10 +93,10 @@ namespace Content.Server.Voting.Managers foreach (var player in _playerManager.ServerSessions) { - if (player != initiator && !_afkManager.IsAfk(player)) + if (player != initiator) { - // Everybody else defaults to a no vote. - vote.CastVote(player, 1); + // Everybody else defaults to an abstain vote to say they don't mind. + vote.CastVote(player, 2); } } } diff --git a/Content.Server/Voting/Managers/VoteManager.cs b/Content.Server/Voting/Managers/VoteManager.cs index d0ff7ade96..e188f26dbc 100644 --- a/Content.Server/Voting/Managers/VoteManager.cs +++ b/Content.Server/Voting/Managers/VoteManager.cs @@ -31,7 +31,6 @@ namespace Content.Server.Voting.Managers [Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly IAdminManager _adminMgr = default!; [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly IAfkManager _afkManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IGameMapManager _gameMapManager = default!; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 8da77d2f2f..2457d997ed 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -727,7 +727,7 @@ 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.8f, CVar.SERVERONLY); + CVarDef.Create("vote.restart_required_ratio", 0.7f, CVar.SERVERONLY); /// /// The delay which two votes of the same type are allowed to be made by separate people, in seconds. @@ -746,7 +746,7 @@ namespace Content.Shared.CCVar /// Sets the duration of the restart vote timer. /// public static readonly CVarDef - VoteTimerRestart = CVarDef.Create("vote.timerrestart", 30, CVar.SERVERONLY); + VoteTimerRestart = CVarDef.Create("vote.timerrestart", 60, CVar.SERVERONLY); /// /// Sets the duration of the gamemode/preset vote timer. diff --git a/Resources/Locale/en-US/voting/managers/vote-manager.ftl b/Resources/Locale/en-US/voting/managers/vote-manager.ftl index d4534fbdc4..1534d6d177 100644 --- a/Resources/Locale/en-US/voting/managers/vote-manager.ftl +++ b/Resources/Locale/en-US/voting/managers/vote-manager.ftl @@ -8,6 +8,7 @@ ui-vote-restart-succeeded = Restart vote succeeded. ui-vote-restart-failed = Restart vote failed (need { TOSTRING($ratio, "P0") }). ui-vote-restart-yes = Yes ui-vote-restart-no = No +ui-vote-restart-abstain = Abstain ui-vote-gamemode-title = Next gamemode ui-vote-gamemode-tie = Tie for gamemode vote! Picking... { $picked }