From 251bf9b97f84efc5a9ada6a913bbffcdfc03b8fc Mon Sep 17 00:00:00 2001 From: vuonojenmustaturska Date: Wed, 15 May 2019 06:34:10 +0300 Subject: [PATCH] Update LINDA_turf_tile.dm (#43962) --- .../environmental/LINDA_turf_tile.dm | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm index d33fac81bb0..e56a5584a2d 100644 --- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm +++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm @@ -96,9 +96,30 @@ /////////////////////////GAS OVERLAYS////////////////////////////// + /turf/open/proc/update_visuals() - var/list/new_overlay_types = tile_graphic() + var/list/atmos_overlay_types = src.atmos_overlay_types // Cache for free performance + var/list/new_overlay_types = list() + var/static/list/nonoverlaying_gases = typecache_of_gases_with_no_overlays() + + if(!air) // 2019-05-14: was not able to get this path to fire in testing. Consider removing/looking at callers -Naksu + if (atmos_overlay_types) + for(var/overlay in atmos_overlay_types) + vis_contents -= overlay + src.atmos_overlay_types = null + return + + var/list/gases = air.gases + + for(var/id in gases) + if (nonoverlaying_gases[id]) + continue + var/gas = gases[id] + var/gas_meta = gas[GAS_META] + var/gas_overlay = gas_meta[META_GAS_OVERLAY] + if(gas_overlay && gas[MOLES] > gas_meta[META_GAS_MOLES_VISIBLE]) + new_overlay_types += gas_overlay[min(FACTOR_GAS_VISIBLE_MAX, CEILING(gas[MOLES] / MOLES_GAS_VISIBLE_STEP, 1))] if (atmos_overlay_types) for(var/overlay in atmos_overlay_types-new_overlay_types) //doesn't remove overlays that would only be added @@ -113,21 +134,6 @@ UNSETEMPTY(new_overlay_types) src.atmos_overlay_types = new_overlay_types -/turf/open/proc/tile_graphic() - var/static/list/nonoverlaying_gases = typecache_of_gases_with_no_overlays() - if(!air) - return - . = new /list - var/list/gases = air.gases - for(var/id in gases) - if (nonoverlaying_gases[id]) - continue - var/gas = gases[id] - var/gas_meta = gas[GAS_META] - var/gas_overlay = gas_meta[META_GAS_OVERLAY] - if(gas_overlay && gas[MOLES] > gas_meta[META_GAS_MOLES_VISIBLE]) - . += gas_overlay[min(FACTOR_GAS_VISIBLE_MAX, CEILING(gas[MOLES] / MOLES_GAS_VISIBLE_STEP, 1))] - /proc/typecache_of_gases_with_no_overlays() . = list() for (var/gastype in subtypesof(/datum/gas))