From 558d11bc73b480298d8e002f1e111f2194761a1b Mon Sep 17 00:00:00 2001 From: Putnam Date: Sun, 18 Oct 2020 14:49:43 -0700 Subject: [PATCH] Stringified the vote #defines for easier config stuff --- code/__DEFINES/vote.dm | 14 +++++++------- code/controllers/configuration/entries/general.dm | 2 +- code/controllers/subsystem/ticker.dm | 13 +------------ config/config.txt | 4 ++-- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/code/__DEFINES/vote.dm b/code/__DEFINES/vote.dm index 175cce3dc4..a3617e21d0 100644 --- a/code/__DEFINES/vote.dm +++ b/code/__DEFINES/vote.dm @@ -1,9 +1,9 @@ -#define PLURALITY_VOTING 0 -#define APPROVAL_VOTING 1 -#define SCHULZE_VOTING 2 -#define SCORE_VOTING 3 -#define MAJORITY_JUDGEMENT_VOTING 4 -#define INSTANT_RUNOFF_VOTING 5 +#define PLURALITY_VOTING "PLURALITY" +#define APPROVAL_VOTING "APPROVAL" +#define SCHULZE_VOTING "SCHULZE" +#define SCORE_VOTING "SCORE" +#define MAJORITY_JUDGEMENT_VOTING "MAJORITY_JUDGEMENT" +#define INSTANT_RUNOFF_VOTING "IRV" #define SHOW_RESULTS (1<<0) #define SHOW_VOTES (1<<1) @@ -26,4 +26,4 @@ GLOBAL_LIST_INIT(display_vote_settings, list(\ "Ongoing Votes" = SHOW_VOTES, "Winner" = SHOW_WINNER, "Abstainers" = SHOW_ABSTENTION -)) \ No newline at end of file +)) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index b3e00af458..48b159baa1 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -290,7 +290,7 @@ /datum/config_entry/flag/tgstyle_maprotation /datum/config_entry/string/map_vote_type - config_entry_value = "SCORE" + config_entry_value = APPROVAL_VOTING /datum/config_entry/number/maprotatechancedelta config_entry_value = 0.75 diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 19f19f05ac..95d8928368 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -482,18 +482,7 @@ SUBSYSTEM_DEF(ticker) INVOKE_ASYNC(SSmapping, /datum/controller/subsystem/mapping/.proc/maprotate) else var/vote_type = CONFIG_GET(string/map_vote_type) - switch(vote_type) - if("PLURALITY") - SSvote.initiate_vote("map","server", display = SHOW_RESULTS) - if("APPROVAL") - SSvote.initiate_vote("map","server", display = SHOW_RESULTS, votesystem = APPROVAL_VOTING) - if("IRV") - SSvote.initiate_vote("map","server", display = SHOW_RESULTS, votesystem = INSTANT_RUNOFF_VOTING) - if("SCORE") - SSvote.initiate_vote("map","server", display = SHOW_RESULTS, votesystem = MAJORITY_JUDGEMENT_VOTING) - else - SSvote.initiate_vote("map","server", display = SHOW_RESULTS) - // fallback + SSvote.initiate_vote("map","server", display = SHOW_RESULTS, votesystem = vote_type) /datum/controller/subsystem/ticker/proc/HasRoundStarted() return current_state >= GAME_STATE_PLAYING diff --git a/config/config.txt b/config/config.txt index a550e6bf8a..7e2ff5da41 100644 --- a/config/config.txt +++ b/config/config.txt @@ -408,7 +408,7 @@ ALLOW_MAP_VOTING 1 ## APPROVAL (can vote for as many as you want), I ## IRV (vote by ranked choice, winner determined by instant runoff algorithm) ## SCORE (give individual rankings of each choice, winner determined by majority judgement algorithm) -MAP_VOTE_TYPE SCORE +MAP_VOTE_TYPE APPROVAL ## Map rotate chance delta ## This is the chance of map rotation factored to the round length. @@ -519,7 +519,7 @@ DEFAULT_VIEW 21x15 ### NOTE FOR LINUX HOSTS: This requires manual setup of iptables. Beware that improper configuration of this can and will irreversibly fuck up a server, so please don't tinker with it if you don't know what you're doing. ## Enabled #FAIL2TOPIC_ENABLED -## Minimum wait time in deciseconds between valid requests +## Minimum wait time in deciseconds between valid requests FAIL2TOPIC_RATE_LIMIT 10 ## Number of requests after breaching rate limit that triggers a ban FAIL2TOPIC_MAX_FAILS 5