mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 00:58:26 +01:00
Fix pre-round lobby map vote filter (#73820)
## About The Pull Request Fixes https://github.com/tgstation/tgstation/issues/73816 ## Changelog 🆑 LT3 fix: Map filter works properly in the pre-round lobby fix: Map vote doesn't log 'not enough players' if the vote starts in the pre-round lobby /🆑 --------- Co-authored-by: tattle <66640614+dragomagol@users.noreply.github.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user