Skip to content

Commit

Permalink
fix(zas): small optimaze zas
Browse files Browse the repository at this point in the history
  • Loading branch information
kreeperHLC committed Oct 13, 2023
1 parent 22bd12b commit 35ef605
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 10 additions & 0 deletions code/game/turfs/simulated.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@
holy = TRUE
levelupdate()

/turf/simulated/Destroy()
if (zone && !zone.invalid)
// Try to remove it gracefully first.
if (can_safely_remove_from_zone())
c_copy_air()
zone.remove(src)
else // Can't remove it safely, just rebuild the entire thing.
zone.rebuild()
return ..()

/turf/simulated/proc/AddTracks(typepath,bloodDNA,comingdir,goingdir,bloodcolor=COLOR_BLOOD_HUMAN)
var/obj/effect/decal/cleanable/blood/tracks/tracks = locate(typepath) in src
if(!tracks)
Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/turf_changing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
ASSERT(N)

// This makes sure that turfs are not changed to space when one side is part of a zone
if(N == /turf/space)
if(ispath(N, /turf/space))
var/turf/below = GetBelow(src)
if(istype(below) && !istype(below,/turf/space))
N = below.density ? /turf/simulated/floor/plating/airless : /turf/simulated/open
Expand Down
8 changes: 3 additions & 5 deletions code/modules/ZAS/Zone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ Class Procs:

var/datum/gas_mixture/air = new

var/list/graphic_add = list()
var/list/graphic_remove = list()

var/datum/lazy_value/zone_movables/movables = new

/zone/New()
Expand Down Expand Up @@ -170,11 +167,12 @@ Class Procs:
if(istype(T))
T.create_fire(vsc.fire_firelevel_multiplier)

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)
graphic_add.len = 0
graphic_remove.len = 0

for(var/connection_edge/E in edges)
if(E.sleeping)
Expand Down

0 comments on commit 35ef605

Please sign in to comment.