From 3e737237e6efbcbe42769c154e5ff229fa1efde6 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 30 Jun 2024 09:27:50 +0200 Subject: [PATCH] [MIRROR] Fixes lightswitch-turning-off mapping helper (#28482) * Fixes lightswitch-turning-off mapping helper (#84399) Fixes #84290 * Fixes lightswitch-turning-off mapping helper --------- Co-authored-by: Afevis --- code/modules/mapping/mapping_helpers.dm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index f30074326fd..e59b04e6c7e 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -563,17 +563,17 @@ if(!mapload) log_mapping("[src] spawned outside of mapload!") return INITIALIZE_HINT_QDEL - check_validity() - return INITIALIZE_HINT_QDEL + return INITIALIZE_HINT_LATELOAD -/obj/effect/mapping_helpers/turn_off_lights_with_lightswitch/proc/check_validity() +/obj/effect/mapping_helpers/turn_off_lights_with_lightswitch/LateInitialize() var/area/needed_area = get_area(src) if(!needed_area.lightswitch) stack_trace("[src] at [AREACOORD(src)] [(needed_area.type)] tried to turn lights off but they are already off!") var/obj/machinery/light_switch/light_switch = locate(/obj/machinery/light_switch) in needed_area if(!light_switch) - stack_trace("Trying to turn off lights with lightswitch in area without lightswitches. In [(needed_area.type)] to be precise.") - needed_area.lightswitch = FALSE + CRASH("Trying to turn off lights with lightswitch in area without lightswitches. In [(needed_area.type)] to be precise.") + light_switch.set_lights(FALSE) + qdel(src) //needs to do its thing before spawn_rivers() is called INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava)