Skip to content

Commit

Permalink
Fixes lightswitch-turning-off mapping helper (tgstation#84399)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShizCalev authored Jun 29, 2024
1 parent e0bcbc1 commit 7098937
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions code/modules/mapping/mapping_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7098937

Please sign in to comment.