Makes lighting objects objects again (#95332)

## About The Pull Request

Continuation of https://github.com/tgstation/tgstation/pull/78857

FOR TOOO LONG WE HAVE SUFF-
Ok yeah so like, we made them overlays to save on maptick, but with
threaded maptick that is potentially not an issue anymore.
I'm opening this pr so I can tm it and see. If it works, it'll save
about 50% of lighting object update costs, which is pretty damn good.

I'm also removing the fullbright light icon state, since it is barely
ever used (it was added as a clientside op, but we don't hit fullbright
very much at all so it does nothing but eat my cpu time)

Also also changing how SSlighting does its resolution. Rather then
waiting for all sources to process, then working on corners and objects,
instead we will do all the sources we had at the start, then all the
sources after, and so on.
The goal is to avoid churn causing the system to constantly choke. it is
better to potentially double operate then it is for things to feel
horrifically slow.

## Why It's Good For The Game

Faster. Also you won't be able to see lights through walls anymore, so
mesons will be less dumb. Can maybe bump their nightvision a bit idk
we'll see.

## Current Issues

to be found

## Changelog
🆑 Absolucy, LemonInTheDark
fix: You can no longer see lights through walls when using mesons or
when ventcrawling.
/🆑

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
Lucy
2026-04-23 08:55:26 +12:00
committed by GitHub
co-authored by LemonInTheDark
parent c048aa41fb
commit 9b6e752f3e
15 changed files with 114 additions and 74 deletions
+14 -3
View File
@@ -4,7 +4,7 @@ SUBSYSTEM_DEF(lighting)
/datum/controller/subsystem/atoms,
/datum/controller/subsystem/mapping,
)
wait = 2
wait = 1
ss_flags = SS_TICKER
var/static/list/sources_queue = list() // List of lighting sources queued for update.
var/static/list/corners_queue = list() // List of lighting corners queued for update.
@@ -38,7 +38,7 @@ SUBSYSTEM_DEF(lighting)
for(var/turf/area_turf as anything in zlevel_turfs)
if(area_turf.space_lit)
continue
new /datum/lighting_object(area_turf)
new /atom/movable/lighting_object(null, area_turf)
CHECK_TICK
CHECK_TICK
@@ -53,6 +53,7 @@ SUBSYSTEM_DEF(lighting)
// UPDATE SOURCE QUEUE
var/i = 0
// something something cache locally for sonic speed
var/list/queue = current_sources
while(i < length(queue)) //we don't use for loop here because i cannot be changed during an iteration
i += 1
@@ -110,7 +111,7 @@ SUBSYSTEM_DEF(lighting)
while(i < length(queue)) //we don't use for loop here because i cannot be changed during an iteration
i += 1
var/datum/lighting_object/O = queue[i]
var/atom/movable/lighting_object/O = queue[i]
if(QDELETED(O))
continue
O.update()
@@ -132,3 +133,13 @@ SUBSYSTEM_DEF(lighting)
/datum/controller/subsystem/lighting/Recover()
initialized = SSlighting.initialized
..()
/// Takes a list of turfs in, and sets up static lighting for them as needed.
/// Exactly what it says on the tin.
/datum/controller/subsystem/lighting/proc/setup_static_lighting_if_needed(list/turfs)
for(var/turf/unlit as anything in turfs)
if(unlit.space_lit)
continue
var/area/loc_area = unlit.loc
if(loc_area.static_lighting)
unlit.lighting_build_overlay()
-15
View File
@@ -744,11 +744,6 @@ ADMIN_VERB(load_away_mission, R_FUN, "Load Away Mission", "Load a specific away
if(contain_turfs)
build_area_turfs(z_value, filled_with_space)
// And finally, misc global generation
// We'll have to update this if offsets change, because we load lowest z to highest z
generate_lighting_appearance_by_z(z_value)
/datum/controller/subsystem/mapping/proc/build_area_turfs(z_level, space_guaranteed)
// If we know this is filled with default tiles, we can use the default area
// Faster
@@ -785,11 +780,6 @@ ADMIN_VERB(load_away_mission, R_FUN, "Load Away Mission", "Load a specific away
z_level_to_lowest_plane_offset[level_to_update.z_value] = plane_offset
z_level_to_stack[level_to_update.z_value] = z_stack
// This can be affected by offsets, so we need to update it
// PAIN
for(var/i in 1 to length(z_list))
generate_lighting_appearance_by_z(i)
var/old_max = max_plane_offset
max_plane_offset = max(max_plane_offset, plane_offset)
if(max_plane_offset == old_max)
@@ -875,11 +865,6 @@ ADMIN_VERB(load_away_mission, R_FUN, "Load Away Mission", "Load a specific away
CRASH("Attempted to lazy load a template key that does not exist: '[template_key]'")
return target.lazy_load()
/proc/generate_lighting_appearance_by_z(z_level)
if(length(GLOB.default_lighting_underlays_by_z) < z_level)
GLOB.default_lighting_underlays_by_z.len = z_level
GLOB.default_lighting_underlays_by_z[z_level] = mutable_appearance(LIGHTING_ICON, "transparent", z_level * 0.01, null, LIGHTING_PLANE, 255, RESET_COLOR | RESET_ALPHA | RESET_TRANSFORM, offset_const = GET_Z_PLANE_OFFSET(z_level))
/// Returns true if the map we're playing on is on a planet
/datum/controller/subsystem/mapping/proc/is_planetary()
return current_map.planetary