Adds logging to failed gamemode startups (#38735)

* Adds logging to failed gamemode startups

* ]

* While i'm here
This commit is contained in:
AnturK
2018-06-27 16:12:35 +02:00
committed by yogstation13-bot
parent cdcd8ed54c
commit 27963e1855
10 changed files with 23 additions and 8 deletions

View File

@@ -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, "<B>Error setting up [GLOB.master_mode].</B> Reverting to pre-game lobby.")
SSjob.ResetOccupations()
return 0

View File

@@ -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()

View File

@@ -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()

View File

@@ -45,6 +45,7 @@
antag_candidates.Remove(devil)
if(devils.len < required_enemies)
setup_error = "Not enough devil candidates"
return 0
return 1

View File

@@ -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, "<b>The gamemode is: <span class='[announce_span]'>[name]</span>!</b>")

View File

@@ -40,6 +40,7 @@
antag_candidates -= carrier
if(!carriers.len)
setup_error = "No monkey candidates"
return FALSE
return TRUE

View File

@@ -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
////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -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

View File

@@ -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()

View File

@@ -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, "<span class='boldannounce'>A starting location for you could not be found, please report this bug!</span>")
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()