mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
credit to zewaka for the idea of using underlays turns the lighting object movables that were unnecessary and increased maptick into a datum which then applies and removes an underlay in update(). also applies a lot of general lighting clean ups (mostly using as anything in loops and fixing single letter var names). multiz is a little different by necessity, now only the bottom turf's lighting matters in the brightness of the top turf unlike master where the bottom turf's lighting object is hidden from the vis_contents of the top turf. there are still some kinks to iron out here though, since currently objects suspended in openspace (like tram platforms) look bad and glass floors look bad too only thing i have left to do is make multiz work (well) UPDATE: multiz now appears the same as far as i can tell, its possible there are other situations in which its different but datum mats work and it automatically updates if the turf below changes. now i just need to make the system less finnicky if at all possible (and possibly merge managed_turf_vis_content with managed_overlays maybe?) new update: its basically equivalent to normal multiz as far as i can tell (visually at least, in the circumstances ive tested so far) NEW NEW UPDATE: turfs no longer have the VIS_HIDE vis_flag and multiz works without stacking the lighting from the floor below! so this shouldnt have any overt drawbacks to master anymore 1 needless movable per tile is terrible for maptick. this is probably a larger improvement than my emissive blocker change in terms of maptick. im guessing we'd get around 0.6 average maptick per player after this where currently we get 0.85 or so Edit: according to lemon, sybil reached 0.71 maptick per person when tm'd with this if this is a big enough improvement i might finally be able to get rid of the Gone discord avatar
93 lines
2.0 KiB
Plaintext
93 lines
2.0 KiB
Plaintext
SUBSYSTEM_DEF(lighting)
|
|
name = "Lighting"
|
|
wait = 2
|
|
init_order = INIT_ORDER_LIGHTING
|
|
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.
|
|
var/static/list/objects_queue = list() // List of lighting objects queued for update.
|
|
|
|
/datum/controller/subsystem/lighting/stat_entry(msg)
|
|
msg = "L:[length(sources_queue)]|C:[length(corners_queue)]|O:[length(objects_queue)]"
|
|
return ..()
|
|
|
|
|
|
/datum/controller/subsystem/lighting/Initialize(timeofday)
|
|
if(!initialized)
|
|
if (CONFIG_GET(flag/starlight))
|
|
for(var/I in GLOB.sortedAreas)
|
|
var/area/A = I
|
|
if (A.dynamic_lighting == DYNAMIC_LIGHTING_IFSTARLIGHT)
|
|
A.luminosity = 0
|
|
|
|
create_all_lighting_objects()
|
|
initialized = TRUE
|
|
|
|
fire(FALSE, TRUE)
|
|
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/lighting/fire(resumed, init_tick_checks)
|
|
MC_SPLIT_TICK_INIT(3)
|
|
if(!init_tick_checks)
|
|
MC_SPLIT_TICK
|
|
var/list/queue = sources_queue
|
|
var/i = 0
|
|
for (i in 1 to length(queue))
|
|
var/datum/light_source/L = queue[i]
|
|
|
|
L.update_corners()
|
|
|
|
L.needs_update = LIGHTING_NO_UPDATE
|
|
|
|
if(init_tick_checks)
|
|
CHECK_TICK
|
|
else if (MC_TICK_CHECK)
|
|
break
|
|
if (i)
|
|
queue.Cut(1, i+1)
|
|
i = 0
|
|
|
|
if(!init_tick_checks)
|
|
MC_SPLIT_TICK
|
|
|
|
queue = corners_queue
|
|
for (i in 1 to length(queue))
|
|
var/datum/lighting_corner/C = queue[i]
|
|
|
|
C.needs_update = FALSE //update_objects() can call qdel if the corner is storing no data
|
|
C.update_objects()
|
|
|
|
if(init_tick_checks)
|
|
CHECK_TICK
|
|
else if (MC_TICK_CHECK)
|
|
break
|
|
if (i)
|
|
queue.Cut(1, i+1)
|
|
i = 0
|
|
|
|
|
|
if(!init_tick_checks)
|
|
MC_SPLIT_TICK
|
|
|
|
queue = objects_queue
|
|
for (i in 1 to length(queue))
|
|
var/datum/lighting_object/O = queue[i]
|
|
|
|
if (QDELETED(O))
|
|
continue
|
|
|
|
O.update()
|
|
O.needs_update = FALSE
|
|
if(init_tick_checks)
|
|
CHECK_TICK
|
|
else if (MC_TICK_CHECK)
|
|
break
|
|
if (i)
|
|
queue.Cut(1, i+1)
|
|
|
|
|
|
/datum/controller/subsystem/lighting/Recover()
|
|
initialized = SSlighting.initialized
|
|
..()
|