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>
This commit is contained in:
Matt Atlas
2025-11-04 22:27:42 +01:00
committed by GitHub
parent 8ebd7c9ad5
commit 94d92803b4
395 changed files with 3906 additions and 3299 deletions
@@ -5,6 +5,8 @@
icon = 'icons/obj/assemblies/electronic_setups.dmi'
icon_state = "setup_small"
item_flags = ITEM_FLAG_NO_BLUDGEON
light_system = MOVABLE_LIGHT
var/max_components = IC_COMPONENTS_BASE
var/max_complexity = IC_COMPLEXITY_BASE
var/opened = 0
@@ -69,7 +69,8 @@
var/light_brightness = 3
var/light_rgb = COLOR_WHITE
power_draw_idle = 0 // Adjusted based on brightness.
light_wedge = LIGHT_WIDE
light_system = MOVABLE_LIGHT
/obj/item/integrated_circuit/output/light/do_work()
light_toggled = !light_toggled
@@ -77,12 +78,13 @@
/obj/item/integrated_circuit/output/light/proc/update_lighting()
if(assembly)
var/atom/atom_holder = assembly.get_assembly_holder()
if(light_toggled)
atom_holder.set_light(l_range = light_brightness, l_power = light_brightness, l_color = light_rgb, uv = 0, angle = light_wedge)
else
atom_holder.set_light(0)
power_draw_idle = light_toggled ? light_brightness * 2 : 0
var/atom/movable/atom_holder = assembly.get_assembly_holder()
if(istype(atom_holder))
if(light_toggled)
atom_holder.set_light_on(FALSE) //make sure the atom holder has movable_light set
else
atom_holder.set_light_on(TRUE)
power_draw_idle = light_toggled ? light_brightness * 2 : 0
/obj/item/integrated_circuit/output/light/disconnect_all()
..()
@@ -98,6 +100,10 @@
light_rgb = new_color
light_brightness = brightness
var/atom/movable/atom_holder = assembly.get_assembly_holder()
if(istype(atom_holder))
atom_holder.set_light_range_power_color(light_brightness, light_brightness, light_rgb)
..()
/obj/item/integrated_circuit/output/light/power_fail() // Turns off the flashlight if there's no power left.