diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 65f7731678b..5c48ae25166 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -531,10 +531,11 @@ GLOBAL_LIST_EMPTY(the_station_areas) message_admins("Failed to set new map with next_map.json for [change_to.map_name]! Using default as backup!") return - if (change_to.config_min_users > 0 && GLOB.clients.len < change_to.config_min_users) + var/filter_threshold = get_active_player_count(alive_check = FALSE, afk_check = TRUE, human_check = FALSE) + if (change_to.config_min_users > 0 && filter_threshold != 0 && filter_threshold < change_to.config_min_users) message_admins("[change_to.map_name] was chosen for the next map, despite there being less current players than its set minimum population range!") log_game("[change_to.map_name] was chosen for the next map, despite there being less current players than its set minimum population range!") - if (change_to.config_max_users > 0 && GLOB.clients.len > change_to.config_max_users) + if (change_to.config_max_users > 0 && filter_threshold > change_to.config_max_users) message_admins("[change_to.map_name] was chosen for the next map, despite there being more current players than its set maximum population range!") log_game("[change_to.map_name] was chosen for the next map, despite there being more current players than its set maximum population range!") diff --git a/code/datums/votes/map_vote.dm b/code/datums/votes/map_vote.dm index 0a41d804b36..b4ff2fd5a81 100644 --- a/code/datums/votes/map_vote.dm +++ b/code/datums/votes/map_vote.dm @@ -67,21 +67,26 @@ message = initial(message) return TRUE -/// Before we create a vote, remove all maps from our choices that are outside of our population range. Note that this can result in zero remaining choices for our vote, which is not ideal (but ultimately okay). +/// Before we create a vote, remove all maps from our choices that are outside of our population range. +/// Note that this can result in zero remaining choices for our vote, which is not ideal (but ultimately okay). /// Argument should_key_choices is TRUE, pass as FALSE in a context where choices are already keyed in a list. /datum/vote/map_vote/proc/check_population(should_key_choices = TRUE) if(should_key_choices) for(var/key in default_choices) choices[key] = 0 - var/active_players = get_active_player_count(alive_check = FALSE, afk_check = TRUE, human_check = FALSE) + var/filter_threshold = 0 + if(SSticker.HasRoundStarted()) + filter_threshold = get_active_player_count(alive_check = FALSE, afk_check = TRUE, human_check = FALSE) + else + filter_threshold = GLOB.clients.len for(var/map in choices) var/datum/map_config/possible_config = config.maplist[map] - if(possible_config.config_min_users > 0 && active_players < possible_config.config_min_users) + if(possible_config.config_min_users > 0 && filter_threshold < possible_config.config_min_users) choices -= map - else if(possible_config.config_max_users > 0 && active_players > possible_config.config_max_users) + else if(possible_config.config_max_users > 0 && filter_threshold > possible_config.config_max_users) choices -= map return choices