diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 6a7331c55d8..c823bfc114c 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -244,8 +244,8 @@ SUBSYSTEM_DEF(ticker) if(!GLOB.Debug2) if(!can_continue) - qdel(mode) - mode = null + log_game("[mode.name] failed pre_setup, cause: [mode.setup_error]") + QDEL_NULL(mode) to_chat(world, "Error setting up [GLOB.master_mode]. Reverting to pre-game lobby.") SSjob.ResetOccupations() return 0 diff --git a/code/game/gamemodes/changeling/changeling.dm b/code/game/gamemodes/changeling/changeling.dm index 4420dc57d90..e3249505db9 100644 --- a/code/game/gamemodes/changeling/changeling.dm +++ b/code/game/gamemodes/changeling/changeling.dm @@ -52,6 +52,7 @@ GLOBAL_VAR(changeling_team_objective_type) //If this is not null, we hand our th changeling.restricted_roles = restricted_jobs return 1 else + setup_error = "Not enough changeling candidates" return 0 /datum/game_mode/changeling/post_setup() diff --git a/code/game/gamemodes/cult/cult.dm b/code/game/gamemodes/cult/cult.dm index de9422d6f77..4e9a9cc6e77 100644 --- a/code/game/gamemodes/cult/cult.dm +++ b/code/game/gamemodes/cult/cult.dm @@ -81,8 +81,11 @@ cultist.restricted_roles = restricted_jobs log_game("[key_name(cultist)] has been selected as a cultist") - - return (cultists_to_cult.len>=required_enemies) + if(cultists_to_cult.len>=required_enemies) + return TRUE + else + setup_error = "Not enough cultist candidates" + return FALSE /datum/game_mode/cult/post_setup() diff --git a/code/game/gamemodes/devil/devil_game_mode.dm b/code/game/gamemodes/devil/devil_game_mode.dm index 2e897539d87..0f2e8f78586 100644 --- a/code/game/gamemodes/devil/devil_game_mode.dm +++ b/code/game/gamemodes/devil/devil_game_mode.dm @@ -45,6 +45,7 @@ antag_candidates.Remove(devil) if(devils.len < required_enemies) + setup_error = "Not enough devil candidates" return 0 return 1 diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index a7d7d6678fd..12791dd870a 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -47,6 +47,7 @@ var/allow_persistence_save = TRUE var/gamemode_ready = FALSE //Is the gamemode all set up and ready to start checking for ending conditions. + var/setup_error //What stopepd setting up the mode. /datum/game_mode/proc/announce() //Shows the gamemode's name and a fast description. to_chat(world, "The gamemode is: [name]!") diff --git a/code/game/gamemodes/monkey/monkey.dm b/code/game/gamemodes/monkey/monkey.dm index 8f7bedd4ddf..76460ffbb8f 100644 --- a/code/game/gamemodes/monkey/monkey.dm +++ b/code/game/gamemodes/monkey/monkey.dm @@ -40,6 +40,7 @@ antag_candidates -= carrier if(!carriers.len) + setup_error = "No monkey candidates" return FALSE return TRUE diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index e42970a692e..4eb5dc1c6e3 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -33,6 +33,7 @@ log_game("[key_name(new_op)] has been selected as a nuclear operative") return TRUE else + setup_error = "Not enough nuke op candidates" return FALSE //////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// diff --git a/code/game/gamemodes/revolution/revolution.dm b/code/game/gamemodes/revolution/revolution.dm index 592d930f7d1..e7ea46f5730 100644 --- a/code/game/gamemodes/revolution/revolution.dm +++ b/code/game/gamemodes/revolution/revolution.dm @@ -58,6 +58,7 @@ lenin.restricted_roles = restricted_jobs if(headrev_candidates.len < required_enemies) + setup_error = "Not enough headrev candidates" return FALSE return TRUE diff --git a/code/game/gamemodes/traitor/traitor.dm b/code/game/gamemodes/traitor/traitor.dm index 4e2c6c19382..1437090ad7b 100644 --- a/code/game/gamemodes/traitor/traitor.dm +++ b/code/game/gamemodes/traitor/traitor.dm @@ -56,7 +56,13 @@ log_game("[key_name(traitor)] has been selected as a [traitor_name]") antag_candidates.Remove(traitor) - return !traitors_required || pre_traitors.len > 0 + var/enough_tators = !traitors_required || pre_traitors.len > 0 + + if(!enough_tators) + setup_error = "Not enough traitor candidates" + return FALSE + else + return TRUE /datum/game_mode/traitor/post_setup() diff --git a/code/game/gamemodes/wizard/wizard.dm b/code/game/gamemodes/wizard/wizard.dm index 32d17fec2c0..d27f9775757 100644 --- a/code/game/gamemodes/wizard/wizard.dm +++ b/code/game/gamemodes/wizard/wizard.dm @@ -25,11 +25,11 @@ wizard.special_role = ROLE_WIZARD log_game("[key_name(wizard)] has been selected as a Wizard") //TODO: Move these to base antag datum if(GLOB.wizardstart.len == 0) - to_chat(wizard.current, "A starting location for you could not be found, please report this bug!") - return 0 + setup_error = "No wizard starting location found" + return FALSE for(var/datum/mind/wiz in wizards) wiz.current.forceMove(pick(GLOB.wizardstart)) - return 1 + return TRUE /datum/game_mode/wizard/post_setup()