[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 <ShizCalev@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-06-30 09:27:50 +02:00
committed by GitHub
parent db7c9f0d7e
commit 3e737237e6
+5 -5
View File
@@ -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)