Adds a unit test to detect double stacked lights (#73650)

## About The Pull Request

They make me sad and we should test for them
I use dir here to prevent like, bulb + bar stuff, idk if that's wanted
or not tho
This commit is contained in:
LemonInTheDark
2023-02-26 19:37:51 -05:00
committed by GitHub
parent 07adb47ec9
commit 63eaec9a58
4 changed files with 14 additions and 3 deletions
@@ -30587,7 +30587,6 @@
},
/area/station/science/auxlab/firing_range)
"hrY" = (
/obj/machinery/light/directional/north,
/obj/item/flashlight/lamp,
/obj/machinery/airalarm/directional/east,
/obj/structure/table/wood,
@@ -43137,7 +43136,6 @@
/turf/open/space/basic,
/area/station/solars/port/aft)
"kur" = (
/obj/machinery/light/directional/south,
/obj/item/kirbyplants/random,
/obj/effect/turf_decal/tile/brown/half/contrasted,
/obj/machinery/light/directional/south,
@@ -47655,7 +47655,6 @@
"qUm" = (
/obj/effect/spawner/random/vending/snackvend,
/obj/machinery/light/directional/east,
/obj/machinery/light/directional/east,
/obj/structure/disposalpipe/segment{
dir = 9
},
+11
View File
@@ -88,6 +88,17 @@
/obj/machinery/light/Initialize(mapload)
. = ..()
// Detect and scream about double stacked lights
if(PERFORM_ALL_TESTS(focus_only/stacked_lights))
var/turf/our_location = get_turf(src)
for(var/obj/machinery/light/on_turf in our_location)
if(on_turf == src)
continue
if(on_turf.dir != dir)
continue
stack_trace("Conflicting double stacked light [on_turf.type] found at ([our_location.x],[our_location.y],[our_location.z])")
qdel(on_turf)
if(!mapload) //sync up nightshift lighting for player made lights
var/area/our_area = get_room_area(src)
var/obj/machinery/power/apc/temp_apc = our_area.apc
@@ -26,3 +26,6 @@
/// Checks that nightvision eyes have a full set of color lists
/datum/unit_test/focus_only/nightvision_color_cutoffs
/// Checks that no light shares a tile/pixel offsets with another
/datum/unit_test/focus_only/stacked_lights