From 417d10832a90e5367da85dc3e7d8bec5ddde4ea9 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Tue, 18 Jul 2023 06:23:36 +0200 Subject: [PATCH] [MIRROR] Properly unreg's turf changed when space openspace is deleted [MDB IGNORE] (#22294) * Properly unreg's turf changed when space openspace is deleted * merge conflict --------- Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Co-authored-by: Bloop --- _maps/shuttles/emergency_tram.dmm | 19 ++++++++----------- code/game/turfs/open/openspace.dm | 2 ++ code/game/turfs/open/space/space.dm | 9 +++++++++ code/modules/unit_tests/create_and_destroy.dm | 3 +++ code/modules/unit_tests/focus_only_tests.dm | 3 +++ 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/_maps/shuttles/emergency_tram.dmm b/_maps/shuttles/emergency_tram.dmm index a2252beabb5..9e0b72fcccb 100644 --- a/_maps/shuttles/emergency_tram.dmm +++ b/_maps/shuttles/emergency_tram.dmm @@ -246,9 +246,6 @@ }, /turf/open/floor/mineral/titanium/yellow, /area/shuttle/escape) -"aU" = ( -/turf/open/openspace/airless, -/area/template_noop) "aV" = ( /obj/machinery/light/directional/east, /obj/item/radio/intercom/directional/north, @@ -426,7 +423,7 @@ ak aQ ak aj -aU +aa aj ak aW @@ -435,7 +432,7 @@ aW ak ak aj -aU +aa aj ak ak @@ -460,7 +457,7 @@ aO aE aS ak -aU +aa ak aE aE @@ -469,7 +466,7 @@ aE aE aP ak -aU +aa ak aX bc @@ -664,7 +661,7 @@ aE aE aE ak -aU +aa ak aV aE @@ -673,7 +670,7 @@ aE aE aE ak -aU +aa ak bb bd @@ -698,7 +695,7 @@ ab ab ak aj -aU +aa aj ak ab @@ -707,7 +704,7 @@ ab ab ak aj -aU +aa aj ak ak diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm index 98628a0c68f..12c7ade160c 100644 --- a/code/game/turfs/open/openspace.dm +++ b/code/game/turfs/open/openspace.dm @@ -23,6 +23,8 @@ // I am so sorry /turf/open/openspace/Initialize(mapload) // handle plane and layer here so that they don't cover other obs/turfs in Dream Maker . = ..() + if(PERFORM_ALL_TESTS(focus_only/openspace_clear) && !GET_TURF_BELOW(src)) + stack_trace("[src] was inited as openspace with nothing below it at ([x], [y], [z])") RegisterSignal(src, COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZED_ON, PROC_REF(on_atom_created)) var/area/our_area = loc if(istype(our_area, /area/space)) diff --git a/code/game/turfs/open/space/space.dm b/code/game/turfs/open/space/space.dm index 4fb72adec98..024dcd80a89 100644 --- a/code/game/turfs/open/space/space.dm +++ b/code/game/turfs/open/space/space.dm @@ -251,6 +251,8 @@ /turf/open/space/openspace/Initialize(mapload) // handle plane and layer here so that they don't cover other obs/turfs in Dream Maker . = ..() + if(PERFORM_ALL_TESTS(focus_only/openspace_clear) && !GET_TURF_BELOW(src)) + stack_trace("[src] was inited as openspace with nothing below it at ([x], [y], [z])") icon_state = "pure_white" // We make the assumption that the space plane will never be blacklisted, as an optimization if(SSmapping.max_plane_offset) @@ -261,6 +263,13 @@ . = ..() AddElement(/datum/element/turf_z_transparency) +/turf/open/space/openspace/Destroy() + // Signals persist through destroy, GO HOME + var/turf/below = GET_TURF_BELOW(src) + if(below) + UnregisterSignal(below, COMSIG_TURF_CHANGE) + return ..() + /turf/open/space/openspace/zAirIn() return TRUE diff --git a/code/modules/unit_tests/create_and_destroy.dm b/code/modules/unit_tests/create_and_destroy.dm index e2b86fcf9ce..00a52da81b2 100644 --- a/code/modules/unit_tests/create_and_destroy.dm +++ b/code/modules/unit_tests/create_and_destroy.dm @@ -119,6 +119,9 @@ GLOBAL_VAR_INIT(running_create_and_destroy, FALSE) ignore += subtypesof(/obj/machinery/airlock_controller) // Always ought to have an associated escape menu. Any references it could possibly hold would need one regardless. ignore += subtypesof(/atom/movable/screen/escape_menu) + // Can't spawn openspace above nothing, it'll get pissy at me + ignore += typesof(/turf/open/space/openspace) + ignore += typesof(/turf/open/openspace) var/list/cached_contents = spawn_at.contents.Copy() var/original_turf_type = spawn_at.type diff --git a/code/modules/unit_tests/focus_only_tests.dm b/code/modules/unit_tests/focus_only_tests.dm index 95953baa9db..0ad0bf961a0 100644 --- a/code/modules/unit_tests/focus_only_tests.dm +++ b/code/modules/unit_tests/focus_only_tests.dm @@ -36,5 +36,8 @@ /// Checks for bad icon / icon state setups in cooking crafting menu /datum/unit_test/focus_only/bad_cooking_crafting_icons +/// Ensures openspace never spawns on the bottom of a z stack +/datum/unit_test/focus_only/openspace_clear + /// Checks to ensure that variables expected to exist in a job datum (for config reasons) actually exist /datum/unit_test/focus_only/missing_job_datum_variables