Add variables to prevent voting of various kinds (#5361)

* Add a way to disable voting for maximum authoritarianism

* Allow disabling specific vote types via cvars

* Migrate standard-vote-to-cvar dictionary to being static
This commit is contained in:
20kdc
2021-11-23 17:03:04 +00:00
committed by GitHub
parent 781a083fcf
commit a2b7982c37
7 changed files with 84 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ using Content.Server.RoundEnd;
using Content.Shared.CCVar;
using Content.Shared.Voting;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
@@ -16,6 +17,13 @@ namespace Content.Server.Voting.Managers
{
public sealed partial class VoteManager
{
private static readonly Dictionary<StandardVoteType, CVarDef<bool>> _voteTypesToEnableCVars = new()
{
{StandardVoteType.Restart, CCVars.VoteRestartEnabled},
{StandardVoteType.Preset, CCVars.VotePresetEnabled},
{StandardVoteType.Map, CCVars.VoteMapEnabled},
};
public void CreateStandardVote(IPlayerSession? initiator, StandardVoteType voteType)
{
switch (voteType)