Gamemode Start Tweaks (#5719)

When the round refuses to start because of a lack of players or lack of antags, it will properly state this instead of stating that there aren't enough players.

The Wizard gamemode, and the Ninja gamemode, both have restrictions that prevent the gamemode from being launched if there are more than 15 players, unless it was voted specifically.
This commit is contained in:
BurgerLUA
2018-12-11 11:38:31 -08:00
committed by Werner
parent 7a813942a1
commit 4cbd2f4e2c
8 changed files with 101 additions and 29 deletions
+1 -1
View File
@@ -987,7 +987,7 @@ var/list/gamemode_cache = list()
var/list/runnable_modes = list()
for(var/game_mode in gamemode_cache)
var/datum/game_mode/M = gamemode_cache[game_mode]
if(M && M.can_start() && probabilities[M.config_tag] && probabilities[M.config_tag] > 0)
if(M && M.can_start() == GAME_FAILURE_NONE && probabilities[M.config_tag] && probabilities[M.config_tag] > 0)
runnable_modes |= M
return runnable_modes
+17 -2
View File
@@ -393,21 +393,36 @@ var/datum/controller/subsystem/ticker/SSticker
src.mode.pre_setup()
SSjobs.DivideOccupations() // Apparently important for new antagonist system to register specific job antags properly.
if(!src.mode.can_start())
var/fail_reasons = list()
var/can_start = src.mode.can_start()
if(can_start & GAME_FAILURE_NO_PLAYERS)
var/list/voted_not_ready = list()
for(var/mob/abstract/new_player/player in player_list)
if((player.client)&&(!player.ready))
voted_not_ready += player.ckey
message_admins("The following players voted for [mode.name], but did not ready up: [jointext(voted_not_ready, ", ")]")
log_game("Ticker: Players voted for [mode.name], but did not ready up: [jointext(voted_not_ready, ", ")]")
world << "<B>Unable to start [mode.name].</B> Not enough players, [mode.required_players] players needed. Reverting to pre-game lobby."
fail_reasons += "Not enough players, [mode.required_players] player(s) needed"
if(can_start & GAME_FAILURE_NO_ANTAGS)
fail_reasons += "Not enough antagonists, [mode.required_enemies] antagonist(s) needed"
if(can_start & GAME_FAILURE_TOO_MANY_PLAYERS)
fail_reasons += "Too many players, less than [mode.max_players] antagonist(s) needed"
if(can_start != GAME_FAILURE_NONE)
world << "<B>Unable to start [mode.name].</B> [english_list(fail_reasons,"No reason specified",". ",". ")]"
current_state = GAME_STATE_PREGAME
mode.fail_setup()
mode = null
SSjobs.ResetOccupations()
if(master_mode in list(ROUNDTYPE_STR_RANDOM, ROUNDTYPE_STR_SECRET, ROUNDTYPE_STR_MIXED_SECRET))
world << "<B>Reselecting gamemode...</B>"
return SETUP_REATTEMPT
else
world << "<B>Reverting to pre-game lobby.</B>"
return SETUP_REVOTE
var/starttime = REALTIMEOFDAY