From a93751bc03cdd62dfb5b576d8fbd0e17751892de Mon Sep 17 00:00:00 2001 From: deathride58 Date: Mon, 19 Nov 2018 23:10:25 -0500 Subject: [PATCH] adds the ability to actually vote for maps instead of using tg's biased preference-based voting system (#7743) --- code/controllers/configuration/entries/general.dm | 2 ++ code/controllers/subsystem/ticker.dm | 7 +++++-- code/controllers/subsystem/vote.dm | 10 ++++++++++ code/modules/client/preferences.dm | 2 +- config/config.txt | 5 +++++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 21b0acd040..53f03ebfff 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -250,6 +250,8 @@ /datum/config_entry/flag/maprotation +/datum/config_entry/flag/tgstyle_maprotation + /datum/config_entry/number/maprotatechancedelta config_entry_value = 0.75 min_val = 0 diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 348bcb23de..6f018424e8 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -449,9 +449,12 @@ SUBSYSTEM_DEF(ticker) maprotatechecked = 1 //map rotate chance defaults to 75% of the length of the round (in minutes) - if (!prob((world.time/600)*CONFIG_GET(number/maprotatechancedelta))) + if (!prob((world.time/600)*CONFIG_GET(number/maprotatechancedelta)) && CONFIG_GET(flag/tgstyle_maprotation)) return - INVOKE_ASYNC(SSmapping, /datum/controller/subsystem/mapping/.proc/maprotate) + if(CONFIG_GET(flag/tgstyle_maprotation)) + INVOKE_ASYNC(SSmapping, /datum/controller/subsystem/mapping/.proc/maprotate) + else + SSvote.initiate_vote("map","server") /datum/controller/subsystem/ticker/proc/HasRoundStarted() return current_state >= GAME_STATE_PLAYING diff --git a/code/controllers/subsystem/vote.dm b/code/controllers/subsystem/vote.dm index 5ab7fe4ec1..14a092d1f9 100644 --- a/code/controllers/subsystem/vote.dm +++ b/code/controllers/subsystem/vote.dm @@ -139,6 +139,12 @@ SUBSYSTEM_DEF(vote) restart = 1 else GLOB.master_mode = . + if("map") + var/datum/map_config/VM = config.maplist[.] + message_admins("The map has been voted for and will change to: [VM.map_name]") + log_admin("The map has been voted for and will change to: [VM.map_name]") + if(SSmapping.changemap(config.maplist[.])) + to_chat(world, "The map vote has chosen [VM.map_name] for next round!") if(restart) var/active_admins = 0 for(var/client/C in GLOB.admins) @@ -194,6 +200,10 @@ SUBSYSTEM_DEF(vote) choices.Add("Restart Round","Continue Playing") if("gamemode") choices.Add(config.votable_modes) + if("map") + choices.Add(config.maplist) + for(var/i in choices)//this is necessary because otherwise we'll end up with a bunch of /datum/map_config's as the default vote value instead of 0 as intended + choices[i] = 0 if("roundtype") //CIT CHANGE - adds the roundstart secret/extended vote choices.Add("secret", "extended") if("custom") diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index d4eed921bd..21fd12a8f4 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -685,7 +685,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) dat += "Ambient Occlusion: [ambientocclusion ? "Enabled" : "Disabled"]
" dat += "Fit Viewport: [auto_fit_viewport ? "Auto" : "Manual"]
" - if (CONFIG_GET(flag/maprotation)) + if (CONFIG_GET(flag/maprotation) && CONFIG_GET(flag/tgstyle_maprotation)) var/p_map = preferred_map if (!p_map) p_map = "Default" diff --git a/config/config.txt b/config/config.txt index 3a74166fe7..33bff862d9 100644 --- a/config/config.txt +++ b/config/config.txt @@ -363,6 +363,11 @@ ANNOUNCE_ADMIN_LOGOUT ## You should edit maps.txt to match your configuration when you enable this. MAPROTATION +## TG-style map rotation +## By default, Citadel uses a more traditional method of map voting, where at the end of a round, players are given a full upfront vote. +## This PR will disable that, and will make the server use TG's map rotation instead. +#TGSTYLE_MAPROTATION + ## Map voting ## Allows players to vote for their preffered map ## When it's set to zero, the map will be randomly picked each round