More light updates!

- Changes how lights function. Instead of lights being qdel'd when you take them in/out of light sockets, it now holds them _in_ the light socket! (Due to this change things have been thoroughly tested, numerous bugs squashed which arose due to this change, and then tested again.)
- Makes it so overlays update properly on lights
- Makes it so light colors persist, even if you turn an alarm off & on again (previously reset the light to normal)
- Made it so nightshift properly updates the overlays of lights.
- Updated the light replacer to swap lights in a more efficient way
- Makes it so light replacers can set the color of the lights being inserted. (This only affects the daytime lights. For more complex changes, a multitool is required.)
This commit is contained in:
C.L
2022-09-05 15:47:46 -04:00
parent aa40f0411c
commit a619121abe
5 changed files with 63 additions and 36 deletions
@@ -53,6 +53,7 @@
var/emagged = 0
var/failmsg = ""
var/charge = 0
var/selected_color = LIGHT_COLOR_INCANDESCENT_TUBE //Default color!
// Eating used bulbs gives us bulb shards
var/bulb_shards = 0
@@ -141,6 +142,10 @@
return
*/
to_chat(usr, "It has [uses] lights remaining.")
var/new_color = input(usr, "Choose a color to set the light to! (Default is [LIGHT_COLOR_INCANDESCENT_TUBE])", "", selected_color) as color|null
if(new_color)
selected_color = new_color
to_chat(usr, "The light color has been changed.")
/obj/item/device/lightreplacer/update_icon()
icon_state = "lightreplacer[emagged]"
@@ -184,19 +189,13 @@
to_chat(U, "<span class='notice'>\The [src] has fabricated a new bulb from the broken bulbs it has stored. It now has [uses] uses.</span>")
playsound(src, 'sound/machines/ding.ogg', 50, 1)
target.status = LIGHT_EMPTY
target.installed_light = null //Remove the light!
target.update()
var/obj/item/weapon/light/L2 = new target.light_type()
target.status = L2.status
target.switchcount = L2.switchcount
target.rigged = emagged
target.brightness_range = L2.brightness_range
target.brightness_power = L2.brightness_power
target.brightness_color = L2.brightness_color
target.on = target.has_power()
L2.brightness_color = selected_color
target.insert_bulb(L2) //Call the insertion proc.
target.update()
qdel(L2)
if(target.on && target.rigged)
target.explode()