Light bloom

This commit is contained in:
quotefox
2022-05-05 00:05:46 +01:00
parent 9ee122d256
commit 77d18eecb9
7 changed files with 47 additions and 0 deletions
+13
View File
@@ -223,6 +223,9 @@
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/light/lighteffect //light effect
/obj/machinery/light/broken
status = LIGHT_BROKEN
icon_state = "tube-broken"
@@ -242,6 +245,8 @@
icon_state = "bulb-broken"
/obj/machinery/light/Move()
if(lighteffect)
lighteffect.loc = src.loc
if(status != LIGHT_BROKEN)
break_light_tube(1)
return ..()
@@ -285,6 +290,8 @@
/obj/machinery/light/Destroy()
var/area/A = get_area(src)
if(lighteffect)
lighteffect.Del()
if(A)
on = FALSE
// A.update_lights()
@@ -292,6 +299,8 @@
return ..()
/obj/machinery/light/update_icon()
if(lighteffect)
lighteffect.Del()
cut_overlays()
switch(status) // set icon_states
if(LIGHT_OK)
@@ -301,6 +310,10 @@
else
icon_state = "[base_state]"
if(on)
lighteffect = new/obj/effect/light/large
lighteffect.loc = src.loc
lighteffect.alpha = CLAMP(light_power*33, 5, 100)
lighteffect.color = light_color
var/mutable_appearance/glowybit = mutable_appearance(overlayicon, base_state, ABOVE_LIGHTING_LAYER, ABOVE_LIGHTING_PLANE)
glowybit.alpha = CLAMP(light_power*250, 30, 200)
add_overlay(glowybit)