Properly unreg's turf changed when space openspace is deleted (#76501)

## About The Pull Request

Openspace tracks the turf below for starlight purposes The trouble is if
a turf is replaced by another, all its signal registers still persist

I forgot about this, so we'd get runtimes when a
/turf/open/space/openspace was replaced, and the turf below it changed

## Why It's Good For The Game

Less random runtimes
This commit is contained in:
LemonInTheDark
2023-07-07 16:02:18 -07:00
committed by GitHub
parent c5aa899a80
commit cfc4e960bc
5 changed files with 25 additions and 11 deletions
+2
View File
@@ -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))
+9
View File
@@ -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
@@ -101,6 +101,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
@@ -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