Fixed votekicks putting you on a one hour vote cooldown (#40622)

* Fixed votekick.timeout cvar not configuring behavior as intended.

* Refactor TimeoutStandardVote to include timeoutOverride
This commit is contained in:
Matt Idzik
2025-10-15 05:41:09 -05:00
committed by GitHub
parent 3ac4816723
commit 6fbcc6d0fb

View File

@@ -456,7 +456,7 @@ namespace Content.Server.Voting.Managers
(Loc.GetString("ui-vote-votekick-abstain"), "abstain") (Loc.GetString("ui-vote-votekick-abstain"), "abstain")
}, },
Duration = TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VotekickTimer)), Duration = TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VotekickTimer)),
InitiatorTimeout = TimeSpan.FromMinutes(_cfg.GetCVar(CCVars.VotekickTimeout)), InitiatorTimeout = TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VotekickTimeout)),
VoterEligibility = voterEligibility, VoterEligibility = voterEligibility,
DisplayVotes = false, DisplayVotes = false,
TargetEntity = targetNetEntity TargetEntity = targetNetEntity
@@ -471,7 +471,7 @@ namespace Content.Server.Voting.Managers
var webhookState = _voteWebhooks.CreateWebhookIfConfigured(options, _cfg.GetCVar(CCVars.DiscordVotekickWebhook), Loc.GetString("votekick-webhook-name"), options.Title + "\n" + Loc.GetString("votekick-webhook-description", ("initiator", initiatorName), ("target", targetSession))); var webhookState = _voteWebhooks.CreateWebhookIfConfigured(options, _cfg.GetCVar(CCVars.DiscordVotekickWebhook), Loc.GetString("votekick-webhook-name"), options.Title + "\n" + Loc.GetString("votekick-webhook-description", ("initiator", initiatorName), ("target", targetSession)));
// Time out the vote now that we know it will happen // Time out the vote now that we know it will happen
TimeoutStandardVote(StandardVoteType.Votekick); TimeoutStandardVote(StandardVoteType.Votekick, TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VotekickTimeout)));
vote.OnFinished += (_, eventArgs) => vote.OnFinished += (_, eventArgs) =>
{ {
@@ -578,9 +578,9 @@ namespace Content.Server.Voting.Managers
} }
} }
private void TimeoutStandardVote(StandardVoteType type) private void TimeoutStandardVote(StandardVoteType type, TimeSpan? timeoutOverride = null)
{ {
var timeout = TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteSameTypeTimeout)); var timeout = timeoutOverride ?? TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteSameTypeTimeout));
_standardVoteTimeout[type] = _timing.RealTime + timeout; _standardVoteTimeout[type] = _timing.RealTime + timeout;
DirtyCanCallVoteAll(); DirtyCanCallVoteAll();
} }