From feccb60c3597d59a9fe4ee81cbd953b203aa899f Mon Sep 17 00:00:00 2001 From: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Date: Mon, 12 Jan 2026 16:51:48 -0600 Subject: [PATCH] Update spotlight plane on z change (#94837) ## About The Pull Request Spotlights don't break on multi-z maps ## Changelog :cl: Melbert fix: Fixed spotlight effect on multi-z map /:cl: --- code/datums/status_effects/neutral.dm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/code/datums/status_effects/neutral.dm b/code/datums/status_effects/neutral.dm index 93e6f89219c..1b5fc8d3e62 100644 --- a/code/datums/status_effects/neutral.dm +++ b/code/datums/status_effects/neutral.dm @@ -773,22 +773,27 @@ /datum/status_effect/spotlight_light/on_apply() mob_light_obj = owner.mob_light(2, 1.5, spotlight_color) + var/turf/owner_turf = get_turf(owner) + beam_from_above_a = new /obj/effect/overlay/spotlight beam_from_above_a.color = spotlight_color beam_from_above_a.alpha = BEAM_ALPHA - owner.vis_contents += beam_from_above_a beam_from_above_a.layer = BELOW_MOB_LAYER + SET_PLANE(beam_from_above_a, PLANE_TO_TRUE(beam_from_above_a.plane), owner_turf) + owner.vis_contents += beam_from_above_a beam_from_above_b = new /obj/effect/overlay/spotlight beam_from_above_b.color = spotlight_color beam_from_above_b.alpha = BEAM_ALPHA beam_from_above_b.layer = ABOVE_MOB_LAYER beam_from_above_b.pixel_y = -2 //Slight vertical offset for an illusion of volume + SET_PLANE(beam_from_above_b, PLANE_TO_TRUE(beam_from_above_b.plane), owner_turf) owner.vis_contents += beam_from_above_b if(additional_overlay) owner.add_overlay(additional_overlay) + RegisterSignal(owner, COMSIG_MOVABLE_Z_CHANGED, PROC_REF(on_z_change)) return TRUE /datum/status_effect/spotlight_light/on_remove() @@ -801,6 +806,13 @@ if(additional_overlay) owner.cut_overlay(additional_overlay) + UnregisterSignal(owner, COMSIG_MOVABLE_Z_CHANGED) + +/datum/status_effect/spotlight_light/proc/on_z_change(mob/living/source, turf/old_turf, turf/new_turf, same_z_layer) + SIGNAL_HANDLER + SET_PLANE(beam_from_above_a, PLANE_TO_TRUE(beam_from_above_a.plane), new_turf) + SET_PLANE(beam_from_above_b, PLANE_TO_TRUE(beam_from_above_b.plane), new_turf) + /datum/status_effect/spotlight_light/divine id = "divine_spotlight"