mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
[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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user