[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 <Deneles@yandex.ru>
This commit is contained in:
SkyratBot
2020-07-31 00:32:11 +02:00
committed by GitHub
co-authored by Dennok
parent aac0a0626c
commit 651e720f2b
+8 -2
View File
@@ -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)