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