From 651e720f2b44f28ff5176018cfcdd8e9aba0eadf Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 31 Jul 2020 00:32:11 +0200 Subject: [PATCH] [MIRROR] Try to replace light overlay to vis_contents (#140) * Try to replace light overlay to vis_contents (#52389) * Try to replace light overlay to vis_contents * move glowybit creation in Initialize * ups * change mutable_appearance to SSvis_overlays * set right settings * Try to replace light overlay to vis_contents Co-authored-by: Dennok --- code/modules/power/lighting.dm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index 258738aab2c..6f0b578e22a 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -239,6 +239,8 @@ var/bulb_emergency_pow_mul = 0.75 // the multiplier for determining the light's power in emergency mode var/bulb_emergency_pow_min = 0.5 // the minimum value for the light's power in emergency mode + var/obj/effect/overlay/vis/glowybit // the light overlay + /obj/machinery/light/broken status = LIGHT_BROKEN icon_state = "tube-broken" @@ -291,6 +293,8 @@ /obj/machinery/light/Initialize(mapload) . = ..() + glowybit = SSvis_overlays.add_vis_overlay(src, overlayicon, base_state, layer, plane, dir, alpha = 0, unique = TRUE) + if(!mapload) //sync up nightshift lighting for player made lights var/area/A = get_area(src) var/obj/machinery/power/apc/temp_apc = A.get_apc() @@ -320,6 +324,8 @@ on = FALSE // A.update_lights() QDEL_NULL(cell) + vis_contents.Cut() + QDEL_NULL(glowybit) return ..() /obj/machinery/light/update_icon_state() @@ -340,9 +346,9 @@ /obj/machinery/light/update_overlays() . = ..() if(on && status == LIGHT_OK) - var/mutable_appearance/glowybit = mutable_appearance(overlayicon, base_state, layer, EMISSIVE_PLANE) glowybit.alpha = clamp(light_power*250, 30, 200) - . += glowybit + else + glowybit.alpha = 0 // update the icon_state and luminosity of the light depending on its state /obj/machinery/light/proc/update(trigger = TRUE)