From 4e39aa496f04744ff74fd18cc0489d7cf88464d2 Mon Sep 17 00:00:00 2001 From: Matt Atlas Date: Tue, 30 May 2023 18:15:34 +0200 Subject: [PATCH] Potentially fix light/atmos lag. (#16379) * Potentially fix light/atmos lag. * oops * 2 * 3 * ff * br --------- Co-authored-by: Matt Atlas --- code/ZAS/Turf.dm | 4 ++-- code/ZAS/Zone.dm | 4 ++++ code/modules/xgm/xgm_gas_mixture.dm | 7 ++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/code/ZAS/Turf.dm b/code/ZAS/Turf.dm index 27df40350e7..27a3a81903b 100644 --- a/code/ZAS/Turf.dm +++ b/code/ZAS/Turf.dm @@ -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() diff --git a/code/ZAS/Zone.dm b/code/ZAS/Zone.dm index a12ab215e96..17936457e2f 100644 --- a/code/ZAS/Zone.dm +++ b/code/ZAS/Zone.dm @@ -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) diff --git a/code/modules/xgm/xgm_gas_mixture.dm b/code/modules/xgm/xgm_gas_mixture.dm index 27bb97b5034..022d315bd91 100644 --- a/code/modules/xgm/xgm_gas_mixture.dm +++ b/code/modules/xgm/xgm_gas_mixture.dm @@ -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