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 21:27:42 +00:00
committed by GitHub
co-authored by Matt Atlas JohnWildkins
parent 8ebd7c9ad5
commit 94d92803b4
395 changed files with 3906 additions and 3299 deletions
+2 -1
View File
@@ -175,9 +175,10 @@
/turf/simulated/open/Initialize(mapload)
. = ..()
icon_state = "" // Clear out the debug icon.
ADD_TRAIT(src, TURF_Z_TRANSPARENT_TRAIT, TRAIT_SOURCE_INHERENT)
update(mapload)
/**
* Updates the turf with open turf's variables and basically resets it properly.
*/
@@ -74,47 +74,6 @@
return ..()
/atom/movable/openspace/multiplier/proc/copy_lighting(atom/movable/lighting_overlay/LO)
appearance = LO
layer = MIMICED_LIGHTING_LAYER
plane = OPEN_SPACE_PLANE_END
set_invisibility(0)
if (icon_state == null)
blend_mode = BLEND_MULTIPLY
// We're using a color matrix, so just darken the colors across the board.
// Bay stores lights as inverted so the lighting PM can invert it for darksight, but
// we don't have a plane master, so invert it again.
var/list/c_list = color
c_list[CL_MATRIX_RR] *= -SHADOWER_DARKENING_FACTOR
c_list[CL_MATRIX_RG] *= -SHADOWER_DARKENING_FACTOR
c_list[CL_MATRIX_RB] *= -SHADOWER_DARKENING_FACTOR
c_list[CL_MATRIX_GR] *= -SHADOWER_DARKENING_FACTOR
c_list[CL_MATRIX_GG] *= -SHADOWER_DARKENING_FACTOR
c_list[CL_MATRIX_GB] *= -SHADOWER_DARKENING_FACTOR
c_list[CL_MATRIX_BR] *= -SHADOWER_DARKENING_FACTOR
c_list[CL_MATRIX_BG] *= -SHADOWER_DARKENING_FACTOR
c_list[CL_MATRIX_BB] *= -SHADOWER_DARKENING_FACTOR
c_list[CL_MATRIX_AR] *= -SHADOWER_DARKENING_FACTOR
c_list[CL_MATRIX_AG] *= -SHADOWER_DARKENING_FACTOR
c_list[CL_MATRIX_AB] *= -SHADOWER_DARKENING_FACTOR
color = c_list
else
// Not a color matrix, so we just ignore the lighting values.
icon_state = "dark" // this is actually just a white sprite, which is what this blending needs
color = list(
SHADOWER_DARKENING_FACTOR, 0, 0,
0, SHADOWER_DARKENING_FACTOR, 0,
0, 0, SHADOWER_DARKENING_FACTOR
)
var/turf/parent = loc
ASSERT(isturf(parent))
if (LAZYLEN(parent.ao_overlays_mimic))
overlays += parent.ao_overlays_mimic
if (bound_overlay)
update_above()
// -- OPENSPACE OVERLAY --
// todo: rename