Potentially fix light/atmos lag. (#16379)

* Potentially fix light/atmos lag.

* oops

* 2

* 3

* ff

* br

---------

Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
Matt Atlas
2023-05-30 18:15:34 +02:00
committed by GitHub
parent 25f1c21fb4
commit 4e39aa496f
3 changed files with 10 additions and 5 deletions

View File

@@ -5,9 +5,9 @@
/turf/var/datum/gas_mixture/air
/turf/simulated/proc/update_graphic(list/graphic_add = null, list/graphic_remove = null)
if (LAZYLEN(graphic_add))
if(graphic_add && LAZYLEN(graphic_add))
vis_contents += graphic_add
if(LAZYLEN(graphic_remove))
if(graphic_remove && LAZYLEN(graphic_remove))
vis_contents -= graphic_remove
/turf/proc/update_air_properties()

View File

@@ -153,11 +153,15 @@ Class Procs:
if(istype(T))
T.create_fire(vsc.fire_firelevel_multiplier)
var/world_time_counter = world.time
var/list/graphic_add = list()
var/list/graphic_remove = list()
if(air.check_tile_graphic(graphic_add, graphic_remove))
for(var/turf/simulated/T in contents)
T.update_graphic(graphic_add, graphic_remove)
var/delta_time = world.time - world_time_counter
if(delta_time > 5 SECONDS)
log_admin("AN AREA IS TAKING EXTREMELY LONG TO UPDATE: [name] WITH CONTENTS LENGTH [length(contents)] TELL MATT WITH THE ROUND ID!")
for(var/connection_edge/E in edges)
if(E.sleeping)

View File

@@ -359,16 +359,17 @@
else
//Overlay isn't applied for this gas, check if it's valid and needs to be added.
if(gas[g] > gas_data.overlay_limit[g])
LAZYADD(graphic_add, gas_data.tile_overlay[g])
if(!(gas_data.tile_overlay[g] in graphic))
LAZYADD(graphic_add, gas_data.tile_overlay[g])
. = 0
//Apply changes
if(LAZYLEN(graphic_add))
if(graphic_add && LAZYLEN(graphic_add))
LAZYINITLIST(graphic)
for (var/entry in graphic_add)
graphic[entry] = TRUE // This is an assoc list to make checking it a bit faster.
. = 1
if(LAZYLEN(graphic_remove))
if(graphic_add && LAZYLEN(graphic_remove))
graphic -= graphic_remove
. = 1