Skip to content

Commit

Permalink
Adds config option to prevent repeating maps (ParadiseSS13#18950)
Browse files Browse the repository at this point in the history
* the map vote sound now haunts my dreams

* aa

* Update config/example/config.toml
  • Loading branch information
S34NW authored Sep 6, 2022
1 parent b1be1b5 commit 633393f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions code/controllers/configuration/sections/vote_configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
var/disable_default_vote = TRUE
/// Enable map voting?
var/enable_map_voting = FALSE
/// If TRUE, you will not be able to vote for the current map
var/non_repeating_maps = TRUE

/datum/configuration_section/vote_configuration/load_data(list/data)
// Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line
CONFIG_LOAD_BOOL(prevent_dead_voting, data["prevent_dead_voting"])
CONFIG_LOAD_BOOL(disable_default_vote, data["disable_default_vote"])
CONFIG_LOAD_BOOL(enable_map_voting, data["enable_map_voting"])
CONFIG_LOAD_BOOL(non_repeating_maps, data["non_repeating_maps"])

CONFIG_LOAD_NUM(vote_time, data["vote_time"])
CONFIG_LOAD_NUM(autotransfer_initial_time, data["autotransfer_initial_time"])
Expand Down
7 changes: 5 additions & 2 deletions code/modules/vote/vote_presets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
/datum/vote/map/generate_choices()
for(var/x in subtypesof(/datum/map))
var/datum/map/M = x
if(initial(M.voteable))
choices.Add("[initial(M.fluff_name)] ([initial(M.technical_name)])")
if(!initial(M.voteable))
continue
if(GLOB.configuration.vote.non_repeating_maps && istype(SSmapping.map_datum, M))
continue
choices.Add("[initial(M.fluff_name)] ([initial(M.technical_name)])")

/datum/vote/map/announce()
..()
Expand Down
3 changes: 2 additions & 1 deletion config/example/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,8 @@ prevent_dead_voting = false
disable_default_vote = true
# Enable voting for a map on end round
enable_map_voting = false

# Set to true to prevent the same map from being voted on twice in a row
non_repeating_maps = true

################################################################

Expand Down

0 comments on commit 633393f

Please sign in to comment.