diff --git a/code/datums/lazy_template.dm b/code/datums/lazy_template.dm index a5ae9e413f3..e3006e13056 100644 --- a/code/datums/lazy_template.dm +++ b/code/datums/lazy_template.dm @@ -64,12 +64,18 @@ if(!reservation) CRASH("Failed to reserve a block for lazy template: '[key]'") + // lists kept for overall loading var/list/loaded_atom_movables = list() var/list/loaded_turfs = list() var/list/loaded_areas = list() + + var/list/obj/structure/cable/loaded_cables = list() + var/list/obj/machinery/atmospherics/loaded_atmospherics = list() + for(var/z_idx in parsed_template.parsed_bounds[MAP_MAXZ] to 1 step -1) var/turf/bottom_left = reservation.bottom_left_turfs[z_idx] var/turf/top_right = reservation.top_right_turfs[z_idx] + load_map( file(load_path), bottom_left.x, @@ -81,12 +87,20 @@ for(var/turf/turf as anything in block(bottom_left, top_right)) loaded_turfs += turf loaded_areas |= get_area(turf) - for(var/thing in turf.get_all_contents()) - // atoms can actually be in the contents of two or more turfs based on its icon/bound size - // see https://www.byond.com/docs/ref/index.html#/atom/var/contents + + // atoms can actually be in the contents of two or more turfs based on its icon/bound size + // see https://www.byond.com/docs/ref/index.html#/atom/var/contents + for(var/thing in (turf.get_all_contents() - turf)) + if(istype(thing, /obj/structure/cable)) + loaded_cables += thing + else if(istype(thing, /obj/machinery/atmospherics)) + loaded_atmospherics += thing loaded_atom_movables |= thing - SSatoms.InitializeAtoms(loaded_atom_movables + loaded_turfs + loaded_areas) + SSatoms.InitializeAtoms(loaded_areas + loaded_atom_movables + loaded_turfs) + SSmachines.setup_template_powernets(loaded_cables) + SSair.setup_template_machinery(loaded_atmospherics) + SEND_SIGNAL(src, COMSIG_LAZY_TEMPLATE_LOADED, loaded_atom_movables, loaded_turfs, loaded_areas) reservations += reservation return reservation diff --git a/code/game/turfs/change_turf.dm b/code/game/turfs/change_turf.dm index f5b40238ed6..1253d156a2c 100644 --- a/code/game/turfs/change_turf.dm +++ b/code/game/turfs/change_turf.dm @@ -252,7 +252,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( //SKYRAT EDIT END if(excited || excited_group) SSair.remove_from_active(src) //Clean up wall excitement, and refresh excited groups - if(ispath(path,/turf/closed) || ispath(path,/turf/cordon)) + if(ispath(path, /turf/closed) || ispath(path, /turf/cordon)) flags |= CHANGETURF_RECALC_ADJACENT return ..() diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index 237ae9f2d52..7917da4d542 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -109,7 +109,6 @@ // need these two below? SSmachines.setup_template_powernets(cables) SSair.setup_template_machinery(atmos_machines) - SSshuttle.setup_shuttles(ports) //calculate all turfs inside the border var/list/template_and_bordering_turfs = block( diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 4ae1c241d06..e11e6bf9156 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -239,6 +239,9 @@ for(var/turf/T in return_turfs()) T.turf_flags |= NO_RUINS + if(SSshuttle.initialized) + INVOKE_ASYNC(SSshuttle, TYPE_PROC_REF(/datum/controller/subsystem/shuttle, setup_shuttles), list(src)) + #ifdef DOCKING_PORT_HIGHLIGHT highlight("#f00") #endif