mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 04:26:03 +01:00
Update spotlight plane on z change (#94837)
## About The Pull Request Spotlights don't break on multi-z maps ## Changelog 🆑 Melbert fix: Fixed spotlight effect on multi-z map /🆑
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user