Files
Aurora.3/code/game/objects/items/devices/lighting/glowstick.dm
T
94d92803b4 Replaces our lighting system with CM's. (#21465)
Depends on #21458.

Ports https://github.com/cmss13-devs/cmss13/pull/4229, with the original
authors as:

- https://github.com/tgstation/TerraGov-Marine-Corps/pull/1964 for the
lighting controller (A-lexa)
- https://github.com/tgstation/TerraGov-Marine-Corps/pull/4747 and
https://github.com/tgstation/TerraGov-Marine-Corps/pull/7263 for the
lighting (TiviPlus)
- https://github.com/tgstation/tgstation/pull/54520 for the dir lighting
component
- https://github.com/tgstation/tgstation/pull/75018 for the out of
bounds fix in lighting
- https://github.com/tgstation/TerraGov-Marine-Corps/pull/6678 for the
emissives (TiviPlus)

The main driving reason behind this is that current lighting consumes
way too much processing power, especially for things like odysseys/away
sites where a billion light sources are processing/moving at once and
the game slows down to a crawl. Hopefully this improves the situation by
a good margin, but we will need some testmerging to confirm that.
<img width="1349" height="1349" alt="image"
src="https://github.com/user-attachments/assets/1059ba2b-c0c5-495a-9c76-2d75d0c42bf2"
/>
<img width="1349" height="1349" alt="image"
src="https://github.com/user-attachments/assets/9704b0f6-4cf6-4dfd-a6cb-5702ad07d677"
/>


- [x] Resolve todos
- [x] Look into open space fuckery (border objects)

---------

Co-authored-by: Matt Atlas <liermattia@gmail.com>
Co-authored-by: JohnWildkins <john.wildkins@gmail.com>
2025-11-04 21:27:42 +00:00

81 lines
2.3 KiB
Plaintext

/obj/item/device/flashlight/flare/glowstick
name = "green glowstick"
desc = "A green military-grade glowstick."
w_class = WEIGHT_CLASS_SMALL
light_system = MOVABLE_LIGHT
light_range = 1.2
flashlight_power = 2
light_color = "#49F37C"
icon_state = "glowstick"
item_state = "glowstick"
produce_heat = 0
activation_sound = 'sound/items/glowstick.ogg'
toggle_sound = null
/obj/item/device/flashlight/flare/glowstick/Initialize()
. = ..()
fuel = rand(9 MINUTES, 12 MINUTES)
set_light_color(color)
/obj/item/device/flashlight/flare/glowstick/process()
fuel = max(fuel - 1, 0)
if(!fuel || !on)
turn_off()
if(!fuel)
src.icon_state = "[initial(icon_state)]-empty"
STOP_PROCESSING(SSprocessing, src)
/obj/item/device/flashlight/flare/glowstick/update_icon()
overlays.Cut()
if(!fuel)
icon_state = "[initial(icon_state)]-empty"
set_light_on(0)
else if(on)
var/image/I = overlay_image(icon, "glowstick-overlay", color)
I.blend_mode = BLEND_ADD
AddOverlays(I)
icon_state = "[initial(icon_state)]-on"
item_state = "[initial(icon_state)]-on"
set_light_range_power_color(light_range, flashlight_power, light_color)
set_light_on(on)
else
icon_state = initial(icon_state)
update_held_icon()
/obj/item/device/flashlight/flare/glowstick/activate(mob/user)
if(istype(user))
user.visible_message(
SPAN_NOTICE("\The [user] cracks and shakes \the [src]."),
SPAN_NOTICE("You crack and shake \the [src], turning it on!"),
SPAN_NOTICE("You hear someone crack and shake a glowstick.")
)
/obj/item/device/flashlight/flare/glowstick/red
name = "red glowstick"
desc = "A red military-grade glowstick."
color = "#FC0F29"
/obj/item/device/flashlight/flare/glowstick/blue
name = "blue glowstick"
desc = "A blue military-grade glowstick."
color = "#599DFF"
/obj/item/device/flashlight/flare/glowstick/orange
name = "orange glowstick"
desc = "A orange military-grade glowstick."
color = "#FA7C0B"
/obj/item/device/flashlight/flare/glowstick/yellow
name = "yellow glowstick"
desc = "A yellow military-grade glowstick."
color = "#FEF923"
/obj/item/device/flashlight/flare/glowstick/random
name = "glowstick"
desc = "A party-grade glowstick."
color = "#FF00FF"
/obj/item/device/flashlight/flare/glowstick/random/Initialize()
color = rgb(rand(50, 255), rand(50, 255), rand(50, 255))
. = ..()