From 74144f2bc9e69c9829339a1bd7ffa962e37c0cd0 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Wed, 1 Feb 2023 01:46:16 -0800 Subject: [PATCH] Fixes some runtime spam from lazyloading/map templates (#73037) ## About The Pull Request Ensures we don't try and rebuild loading turfs midload Turf refs persist through destroy, so when we changeturf earlier to get our turf reservation, we insert our space turfs into the rebuild queue, and then end up here where we can be rebuilt randomly, midload, with uninit'd turfs Avoids starting atmos machine processing until init This avoids some runtimes with null gasmixtures There's still trouble with atmos and template loading, pipes start processing before their pipelines exist, so we just kinda get fucked. Need to look into this more deeply, it involves pulling this stuff off `on_construct` and `setup_template_machinery` and throwing it in maybe late init, which I don't really relish but will just have to do eventually. ## Why It's Good For The Game Reduces runtime spam --- code/modules/atmospherics/machinery/atmosmachinery.dm | 8 ++++++-- code/modules/mapping/map_template.dm | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index 3e7024ae57f..b96f022298f 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -61,6 +61,9 @@ ///keeps the name of the object from being overridden if it's vareditted. var/override_naming + ///If we should init and immediately start processing + var/init_processing = FALSE + armor_type = /datum/armor/machinery_atmospherics /datum/armor/machinery_atmospherics @@ -89,9 +92,8 @@ if(pipe_flags & PIPING_CARDINAL_AUTONORMALIZE) normalize_cardinal_directions() nodes = new(device_type) + init_processing = process ..() - if(process) - SSair.start_processing_machine(src) set_init_directions(init_dir) /obj/machinery/atmospherics/Initialize(mapload) @@ -103,6 +105,8 @@ turf_loc.add_blueprints_preround(src) SSspatial_grid.add_grid_awareness(src, SPATIAL_GRID_CONTENTS_TYPE_ATMOS) SSspatial_grid.add_grid_membership(src, turf_loc, SPATIAL_GRID_CONTENTS_TYPE_ATMOS) + if(init_processing) + SSair.start_processing_machine(src) return ..() /obj/machinery/atmospherics/Destroy() diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index b87a1142e2c..50d7ead2e5f 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -157,9 +157,12 @@ if((T.y+height) - 1 > world.maxy) return + // Cache for sonic speed + var/list/to_rebuild = SSair.adjacent_rebuild // iterate over turfs in the border and clear them from active atmos processing for(var/turf/border_turf as anything in CORNER_BLOCK_OFFSET(T, width + 2, height + 2, -1, -1)) SSair.remove_from_active(border_turf) + to_rebuild -= border_turf for(var/turf/sub_turf as anything in border_turf.atmos_adjacent_turfs) sub_turf.atmos_adjacent_turfs?.Remove(border_turf) border_turf.atmos_adjacent_turfs?.Cut()