Skip to content

Commit 942415a

Browse files
authored
adds more logging to game start failures (#1196)
1 parent b139591 commit 942415a

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

code/controllers/subsystem/job.dm

+6-2
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ SUBSYSTEM_DEF(job)
438438

439439
. = assign_captain()
440440
if(!.)
441+
SSticker.mode.setup_error += "Failed to assign captain. See JobDebug for more information."
441442
return FALSE
442443

443444
//People who wants to be the overflow role, sure, go on.
@@ -528,6 +529,7 @@ SUBSYSTEM_DEF(job)
528529
if(!AssignRole(player, GetJobType(overflow_role))) //If everything is already filled, make them an assistant
529530
JobDebug("DO, Forced antagonist could not be assigned any random job or the overflow role. DivideOccupations failed.")
530531
JobDebug("---------------------------------------------------")
532+
SSticker.mode.setup_error += "An unassigned player could not be given a random or overflow role. See JobDebug for more information."
531533
return FALSE //Living on the edge, the forced antagonist couldn't be assigned to overflow role (bans, client age) - just reroll
532534

533535
JobDebug("DO, Ending handle unrejectable unassigned")
@@ -543,6 +545,8 @@ SUBSYSTEM_DEF(job)
543545
we_fucked = TRUE
544546

545547
if(we_fucked)
548+
JobDebug("DO, could not fill all departments.")
549+
SSticker.mode.setup_error += "Could not fill all required departments. See JobDebug for more information."
546550
return FALSE
547551

548552
JobDebug("DO, all departments have atleast one player.")
@@ -1076,12 +1080,12 @@ SUBSYSTEM_DEF(job)
10761080
for(var/rank in required_group)
10771081
var/datum/job/J = GetJob(rank)
10781082
if(!J)
1079-
SSticker.mode.setup_error = "Invalid job [rank] in gamemode required jobs."
1083+
SSticker.mode.setup_error += "Invalid job [rank] in gamemode required jobs."
10801084
return FALSE
10811085
if(J.current_positions < required_group[rank])
10821086
group_ok = FALSE
10831087
break
10841088
if(group_ok)
10851089
return TRUE
1086-
SSticker.mode.setup_error = "Required jobs not present."
1090+
SSticker.mode.setup_error += "Required jobs not present."
10871091
return FALSE

code/controllers/subsystem/ticker.dm

+2-2
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,8 @@ SUBSYSTEM_DEF(ticker)
832832

833833
if(!GLOB.Debug2)
834834
if(!can_continue)
835-
log_game("[get_mode_name(TRUE)] failed pre_setup, cause: [mode.setup_error].")
836-
message_admins("[get_mode_name(TRUE)] failed pre_setup, cause: [mode.setup_error].")
835+
log_game("[get_mode_name(TRUE)] failed pre_setup, cause(s): [english_list(mode.setup_error)].")
836+
message_admins("[get_mode_name(TRUE)] failed pre_setup, cause(s): [english_list(mode.setup_error)].")
837837
to_chat(world, "<B>Error setting up [get_mode_name(TRUE)].</B> Reverting to pre-game lobby.")
838838
mode.on_failed_execute()
839839
QDEL_NULL(mode)

code/game/gamemodes/game_mode.dm

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
///Is the gamemode votable? !Not implimented!
2222
var/votable = FALSE
2323

24-
///Dynamically set to what the problem was. Or the first problem, anyway.
25-
var/setup_error = ""
24+
///Dynamically set to what the problem(s) was/were.
25+
var/list/setup_error = list()
2626

2727
///The minimum players this gamemode can roll
2828
var/min_pop = 1
@@ -82,14 +82,14 @@
8282
/datum/game_mode/proc/execute_roundstart()
8383
SHOULD_CALL_PARENT(TRUE)
8484
if(!pre_setup())
85-
setup_error ||= "Failed pre_setup."
85+
setup_error += "Failed pre_setup."
8686
return FALSE
8787

8888
antagonists = GLOB.pre_setup_antags.Copy()
8989
GLOB.pre_setup_antags.Cut()
9090
var/number_of_antags = length(antagonists)
9191
if(number_of_antags < required_enemies)
92-
setup_error = "Not enough antagonists selected. Required [required_enemies], got [number_of_antags]."
92+
setup_error += "Not enough antagonists selected. Required [required_enemies], got [number_of_antags]."
9393
return FALSE
9494

9595
return TRUE
@@ -124,7 +124,7 @@
124124
// Strip out antag bans/people without this antag as a pref
125125
trim_candidates(possible_antags)
126126
if(!length(possible_antags))
127-
setup_error = "No possible antagonists found"
127+
setup_error += "No possible antagonists found"
128128
return FALSE
129129
return TRUE
130130

0 commit comments

Comments
 (0)