mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
updating turf gas overlays is now delta-based
Fixes issues with mine turfs and other turfs that use overlays. Signed-off-by: Mloc-Argent <colmohici@gmail.com>
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
/turf/simulated/var/zone/zone
|
||||
/turf/simulated/var/open_directions
|
||||
/turf/simulated/var/gas_graphic
|
||||
|
||||
/turf/var/needs_air_update = 0
|
||||
/turf/var/datum/gas_mixture/air
|
||||
|
||||
/turf/simulated/proc/set_graphic(new_graphic)
|
||||
gas_graphic = new_graphic
|
||||
overlays.Cut()
|
||||
for(var/i in gas_graphic)
|
||||
overlays += i
|
||||
/turf/simulated/proc/update_graphic(list/graphic_add = null, list/graphic_remove = null)
|
||||
if(graphic_add)
|
||||
overlays += graphic_add
|
||||
if(graphic_remove)
|
||||
overlays -= graphic_remove
|
||||
|
||||
/turf/proc/update_air_properties()
|
||||
var/block = c_airblock(src)
|
||||
|
||||
@@ -51,6 +51,9 @@ Class Procs:
|
||||
|
||||
/zone/var/datum/gas_mixture/air = new
|
||||
|
||||
/zone/var/list/graphic_add = list()
|
||||
/zone/var/list/graphic_remove = list()
|
||||
|
||||
/zone/New()
|
||||
air_master.add_zone(src)
|
||||
air.temperature = TCMB
|
||||
@@ -71,7 +74,7 @@ Class Procs:
|
||||
if(T.fire)
|
||||
fire_tiles.Add(T)
|
||||
air_master.active_fire_zones.Add(src)
|
||||
T.set_graphic(air.graphic)
|
||||
T.update_graphic(air.graphic)
|
||||
|
||||
/zone/proc/remove(turf/simulated/T)
|
||||
#ifdef ZASDBG
|
||||
@@ -83,7 +86,7 @@ Class Procs:
|
||||
contents.Remove(T)
|
||||
fire_tiles.Remove(T)
|
||||
T.zone = null
|
||||
T.set_graphic(0)
|
||||
T.update_graphic(graphic_remove = air.graphic)
|
||||
if(contents.len)
|
||||
air.group_multiplier = contents.len
|
||||
else
|
||||
@@ -128,9 +131,11 @@ Class Procs:
|
||||
air.group_multiplier = contents.len+1
|
||||
|
||||
/zone/proc/tick()
|
||||
if(air.check_tile_graphic())
|
||||
if(air.check_tile_graphic(graphic_add, graphic_remove))
|
||||
for(var/turf/simulated/T in contents)
|
||||
T.set_graphic(air.graphic)
|
||||
T.update_graphic(graphic_add, graphic_remove)
|
||||
graphic_add.len = 0
|
||||
graphic_remove.len = 0
|
||||
|
||||
/zone/proc/dbg_data(mob/M)
|
||||
M << name
|
||||
|
||||
@@ -268,12 +268,8 @@
|
||||
zburn(null)
|
||||
|
||||
//Rechecks the gas_mixture and adjusts the graphic list if needed.
|
||||
/datum/gas_mixture/proc/check_tile_graphic()
|
||||
//List of new overlays that weren't valid before.
|
||||
var/list/graphic_add = null
|
||||
//List of overlays that need to be removed now that they're not valid.
|
||||
var/list/graphic_remove = null
|
||||
|
||||
//Two lists can be passed by reference if you need know specifically which graphics were added and removed.
|
||||
/datum/gas_mixture/proc/check_tile_graphic(list/graphic_add = null, list/graphic_remove = null)
|
||||
for(var/g in gas_data.overlay_limit)
|
||||
if(graphic.Find(gas_data.tile_overlay[g]))
|
||||
//Overlay is already applied for this gas, check if it's still valid.
|
||||
|
||||
Reference in New Issue
Block a user