diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 7c33a9962ed..09d66198650 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -100,6 +100,8 @@ var/list/modes = list() // allowed modes var/list/votable_modes = list() // votable modes var/list/probabilities = list() // relative probability of each mode + var/list/min_pop = list() // overrides for acceptible player counts in a mode + var/list/max_pop = list() var/humans_need_surnames = 0 var/allow_ai = 0 // allow ai job @@ -536,6 +538,34 @@ config.midround_antag_time_check = text2num(value) if("midround_antag_life_check") config.midround_antag_life_check = text2num(value) + if("min_pop") + var/pop_pos = findtext(value, " ") + var/mode_name = null + var/mode_value = null + + if(pop_pos) + mode_name = lowertext(copytext(value, 1, pop_pos)) + mode_value = copytext(value, pop_pos + 1) + if(mode_name in config.modes) + config.min_pop[mode_name] = text2num(mode_value) + else + diary << "Unknown minimum population configuration definition: [mode_name]." + else + diary << "Incorrect minimum population configuration definition: [mode_name] [mode_value]." + if("max_pop") + var/pop_pos = findtext(value, " ") + var/mode_name = null + var/mode_value = null + + if(pop_pos) + mode_name = lowertext(copytext(value, 1, pop_pos)) + mode_value = copytext(value, pop_pos + 1) + if(mode_name in config.modes) + config.max_pop[mode_name] = text2num(mode_value) + else + diary << "Unknown maximum population configuration definition: [mode_name]." + else + diary << "Incorrect maximum population configuration definition: [mode_name] [mode_value]." if("shuttle_refuel_delay") config.shuttle_refuel_delay = text2num(value) if("show_game_type_odds") @@ -774,6 +804,10 @@ if(probabilities[M.config_tag]<=0) qdel(M) continue + if(min_pop[M.config_tag]) + M.required_players = min_pop[M.config_tag] + if(max_pop[M.config_tag]) + M.maximum_players = max_pop[M.config_tag] if(M.can_start()) runnable_modes[M] = probabilities[M.config_tag] //world << "DEBUG: runnable_mode\[[runnable_modes.len]\] = [M.config_tag]" @@ -789,7 +823,13 @@ if(probabilities[M.config_tag]<=0) qdel(M) continue + if(min_pop[M.config_tag]) + M.required_players = min_pop[M.config_tag] + if(max_pop[M.config_tag]) + M.maximum_players = max_pop[M.config_tag] if(M.required_players <= crew) + if(M.maximum_players >= 0 && M.maximum_players < crew) + continue runnable_modes[M] = probabilities[M.config_tag] return runnable_modes diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 4ef1f5bcf7b..54c13990026 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -25,6 +25,7 @@ var/list/restricted_jobs = list() // Jobs it doesn't make sense to be. I.E chaplain or AI cultist var/list/protected_jobs = list() // Jobs that can't be traitors because var/required_players = 0 + var/maximum_players = -1 // -1 is no maximum, positive numbers limit the selection of a mode on overstaffed stations var/required_enemies = 0 var/recommended_enemies = 0 var/antag_flag = null //preferences flag such as BE_WIZARD that need to be turned on for players to be antag @@ -56,7 +57,7 @@ if((player.client)&&(player.ready)) playerC++ if(!Debug2) - if(playerC < required_players) + if(playerC < required_players || (maximum_players >= 0 && playerC > maximum_players)) return 0 antag_candidates = get_players_for_role(antag_flag) if(!Debug2) diff --git a/config/game_options.txt b/config/game_options.txt index f6c6dc7e8de..a426e6ef78f 100644 --- a/config/game_options.txt +++ b/config/game_options.txt @@ -141,6 +141,62 @@ MIDROUND_ANTAG BLOB #MIDROUND_ANTAG RAGINMAGES #MIDROUND_ANTAG MONKEY +## Uncomment for overrides of the minimum / maximum number of players in a round type. +## If you set any of these occasionally check to see if you still need them as the modes +## will still be actively rebalanced around the SUGGESTED populations, not your overrides. +## Notes: For maximum number of players a value of -1 means no maximum. Setting minimums to +## VERY low numbers (< 5) can lead to errors if the roundtypes were not designed for that. + +#MIN_POP TRAITOR 0 +#MAX_POP TRAITOR -1 + +#MIN_POP TRAITORCHAN 15 +#MAX_POP TRAITORCHAN -1 + +#MIN_POP DOUBLE_AGENTS 25 +#MAX_POP DOUBLE_AGENTS -1 + +#MIN_POP NUCLEAR 0 +#MAX_POP NUCLEAR -1 + +#MIN_POP REVOLUTION 20 +#MAX_POP REVOLUTION -1 + +#MIN_POP GANG 20 +#MAX_POP GANG -1 + +#MIN_POP CULT 24 +#MAX_POP CULT -1 + +#MIN_POP CLOCKWORK_CULT 24 +#MAX_POP CLOCKWORK_CULT -1 + +#MIN_POP CHANGELING 15 +#MAX_POP CHANGELING -1 + +#MIN_POP WIZARD 20 +#MAX_POP WIZARD -1 + +#MIN_POP BLOB 25 +#MAX_POP BLOB -1 + +#MIN_POP MONKEY 20 +#MAX_POP MONKEY -1 + +#MIN_POP METEOR 0 +#MAX_POP METEOR -1 + +#MIN_POP DEVIL 0 +#MAX_POP DEVIL -1 + +#MIN_POP DEVIL_AGENTS 25 +#MAX_POP DEVIL_AGENTS -1 + +## Setting at least one mode to be playable at 0/1 players is required. +#MIN_POP EXTENDED 0 +#MAX_POP EXTENDED -1 + + ## The amount of time it takes for the emergency shuttle to be called, from round start. SHUTTLE_REFUEL_DELAY 12000