diff --git a/code/__HELPERS/piping_colors_lists.dm b/code/__HELPERS/piping_colors_lists.dm index c012d77eb8c..efbe2c81bf5 100644 --- a/code/__HELPERS/piping_colors_lists.dm +++ b/code/__HELPERS/piping_colors_lists.dm @@ -37,7 +37,7 @@ GLOBAL_LIST_INIT(pipe_colors_ordered, sortTim(list( PIPE_COLOR_PURPLE = 2, PIPE_COLOR_RED = 3, PIPE_COLOR_YELLOW = 4 -), /proc/cmp_name_asc)) +), /proc/cmp_text_asc)) ///Names shown in the examine for every colored atmos component GLOBAL_LIST_INIT(pipe_color_name, sortTim(list( @@ -51,4 +51,4 @@ GLOBAL_LIST_INIT(pipe_color_name, sortTim(list( PIPE_COLOR_YELLOW = "yellow", PIPE_COLOR_BROWN = "brown", PIPE_COLOR_PURPLE = "purple" -), /proc/cmp_name_asc)) +), /proc/cmp_text_asc)) diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 613c538fd50..6360353ccdb 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -62,6 +62,8 @@ GLOBAL_REAL(Master, /datum/controller/master) = new var/static/current_ticklimit = TICK_LIMIT_RUNNING /datum/controller/master/New() + // CITADEL SNOWFLAKING: see world.dm for why + world.ensure_logging_active() if(!config_legacy) load_configuration() if(!config) diff --git a/code/game/world.dm b/code/game/world.dm index d1338dcca14..205099c6973 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -25,13 +25,10 @@ GLOBAL_LIST(topic_status_cache) var/tempfile = "data/logs/config_error.[GUID()].log" //temporary file used to record errors with loading config, moved to log directory once logging is set GLOB.config_error_log = GLOB.world_href_log = GLOB.world_runtime_log = GLOB.world_map_error_log = GLOB.world_attack_log = GLOB.world_game_log = tempfile - world.log = tempfile - world.Profile(PROFILE_START) make_datum_reference_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once) setupgenetics() - GLOB.revdata = new InitTgs() @@ -47,7 +44,8 @@ GLOBAL_LIST(topic_status_cache) // world.log = file("[GLOB.log_directory]/dd.log") //not all runtimes trigger world/Error, so this is the only way to ensure we can see all of them. // #endif - world.log = file("[GLOB.log_directory]/dd.log") // screw you, disk space be damned our codebase has 50000 errors, START FIXING THEM. + // shunt redirected world log from Master's init back into world log proper, now that logging has been set up. + shunt_redirected_log() config_legacy.post_load() @@ -103,6 +101,33 @@ GLOBAL_LIST(topic_status_cache) GLOB.revdata.load_tgs_info() GLOB.tgs_initialized = TRUE +GLOBAL_REAL_VAR(world_log_redirected) = FALSE + +/** + * so it turns out that if GLOB init or something before world.log redirect runtimes we have no way of catching it in CI + * which is really bad?? because we kind of need it?? + * therefore + */ +/world/proc/ensure_logging_active() + if(global.world_log_redirected) + return + global.world_log_redirected = TRUE + world.log = file("data/logs/world_init_temporary.log") + +/** + * world/New is running, shunt all of the output back. + */ +/world/proc/shunt_redirected_log() + if(!fexists("data/logs/world_init_temporary.log")) + return + world.log = file("[GLOB.log_directory]/dd.log") + log_world("Shunting preinit logs as follows:") + for(var/line in world.file2list("data/logs/world_init_temporary.log")) + line = trim(line) + if(!length(line)) + continue + log_world(line) + /world/proc/HandleTestRun() //trigger things to run the whole process Master.sleep_offline_after_initializations = FALSE diff --git a/code/modules/error_handler/error_handler.dm b/code/modules/error_handler/error_handler.dm index 817919b30b7..eed14493c91 100644 --- a/code/modules/error_handler/error_handler.dm +++ b/code/modules/error_handler/error_handler.dm @@ -1,10 +1,11 @@ -GLOBAL_VAR_INIT(total_runtimes, GLOB.total_runtimes || 0) +// Why? Because when you screw up too early in init, total runtimes won't be initialized. You can see why this can be a problem, right? +GLOBAL_REAL_VAR(total_runtimes) = 0 GLOBAL_VAR_INIT(total_runtimes_skipped, 0) #ifdef USE_CUSTOM_ERROR_HANDLER #define ERROR_USEFUL_LEN 2 /world/Error(exception/E, datum/e_src) - GLOB.total_runtimes++ + ++global.total_runtimes if(!istype(E)) //Something threw an unusual exception log_world("uncaught runtime error: [E]")