Final parts of ZAS. Works like a charm now.

This commit is contained in:
SkyMarshal
2012-06-23 21:20:39 -07:00
parent ba75994b29
commit e0edc29acf
5 changed files with 88 additions and 65 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ datum
if(S.CanPass(null, S, 0, 0))
new/zone(S)
tiles_to_update |= S
S.update_air_properties()
world << "\red \b Geometry processed in [time2text(world.timeofday-start_time, "mm:ss")] minutes!"
spawn start()
+1 -1
View File
@@ -219,7 +219,7 @@ turf
if(NT && NT.zone && NT.zone == T.zone)
T.zone.rebuild = 1
else if((!T.CanPass(null, src, 1.5, 1) && T.CanPass(null, src, 0, 0)) || (!CanPass(null, T, 1.5, 1) && CanPass(null, T, 0, 0)))
else if(T.CanPass(null, src, 0, 0))
if(T.zone != zone)
ZConnect(src,T)
+76 -62
View File
@@ -1,5 +1,4 @@
#define QUANTIZE(variable) (round(variable,0.0001))
var/explosion_halt = 0
vs_control/var/zone_share_percent = 10
vs_control/var/zone_share_percent_NAME = "Zone Share Percent"
vs_control/var/zone_share_percent_DESC = "Percentage of air difference to move per tick"
@@ -10,67 +9,8 @@ zone/proc/process()
return 0
//Does rebuilding stuff. Not sure if used.
if(rebuild)
//Choose a random turf and regenerate the zone from it.
var
turf/simulated/sample = pick(contents)
list/new_contents
problem = 0
if(space_tiles)
del(space_tiles)
contents.Remove(null) //I can't believe this is needed.
if(!contents.len)
del src
var/list/tried_turfs = list()
do
if(sample)
tried_turfs |= sample
var/list/turfs_to_consider = contents - tried_turfs
if(!turfs_to_consider.len)
break
sample = pick(turfs_to_consider) //Nor this.
while(!istype(sample) || !sample.CanPass(null, sample, 1.5, 1))
if(!istype(sample) || !sample.CanPass(null, sample, 1.5, 1)) //Not a single valid turf.
for(var/turf/simulated/T in contents)
air_master.tiles_to_update |= T
del src
new_contents = FloodFill(sample)
for(var/turf/space/S in new_contents)
if(!space_tiles)
space_tiles = list()
space_tiles |= S
//If something isn't carried over, there was a complication.
for(var/turf/T in contents)
if(!(T in new_contents))
problem = 1
T.zone = null
if(problem)
//Build some new zones for stuff that wasn't included.
var/list/turf/simulated/rebuild_turfs = contents - new_contents
var/list/turf/simulated/reconsider_turfs = list()
contents = new_contents
for(var/turf/T in rebuild_turfs)
if(istype(T,/turf/space))
air_master.tiles_to_update |= T
else if(!T.zone && T.CanPass(null, T, 1.5, 1))
var/zone/Z = new /zone(T)
Z.air.copy_from(air)
else
reconsider_turfs |= T
for(var/turf/T in reconsider_turfs)
if(!T.zone)
var/zone/Z = new /zone(T)
Z.air.copy_from(air)
rebuild = 0
Rebuild() //Shoving this into a proc.
//Sometimes explosions will cause the air to be deleted for some reason.
if(!air)
@@ -272,4 +212,78 @@ zone/proc/connected_zones()
.[Z]++
else
. += Z
.[Z] = 1
.[Z] = 1
zone/proc/Rebuild()
//Choose a random turf and regenerate the zone from it.
var
turf/simulated/sample = pick(contents)
list/new_contents
problem = 0
if(space_tiles)
del(space_tiles)
contents.Remove(null) //I can't believe this is needed.
if(!contents.len)
del src
var/list/tried_turfs = list()
do
if(sample)
tried_turfs |= sample
var/list/turfs_to_consider = contents - tried_turfs
if(!turfs_to_consider.len)
break
sample = pick(turfs_to_consider) //Nor this.
while(!istype(sample) || !sample.CanPass(null, sample, 1.5, 1))
if(!istype(sample) || !sample.CanPass(null, sample, 1.5, 1)) //Not a single valid turf.
for(var/turf/simulated/T in contents)
air_master.tiles_to_update |= T
del src
new_contents = FloodFill(sample)
for(var/turf/space/S in new_contents)
if(!space_tiles)
space_tiles = list()
space_tiles |= S
if(contents.len != new_contents.len)
problem = 1
//If something isn't carried over, there was a complication.
for(var/turf/T in contents)
if(!(T in new_contents))
T.zone = null
problem = 1
for(var/turf/T in new_contents)
if(problem)
//Build some new zones for stuff that wasn't included.
var/list/turf/simulated/rebuild_turfs = contents - new_contents
var/list/turf/simulated/reconsider_turfs = list()
contents = new_contents
for(var/turf/T in rebuild_turfs)
if(istype(T,/turf/space))
air_master.tiles_to_update |= T
else if(!T.zone && T.CanPass(null, T, 1.5, 1))
var/zone/Z = new /zone(T)
Z.air.copy_from(air)
else
reconsider_turfs |= T
for(var/turf/T in reconsider_turfs)
if(!T.zone)
var/zone/Z = new /zone(T)
Z.air.copy_from(air)
for(var/turf/T in contents)
if(T.zone && T.zone != src)
T.zone.RemoveTurf(T)
T.zone = src
else if(!T.zone)
T.zone = src
air.group_multiplier = contents.len
+1
View File
@@ -167,6 +167,7 @@ datum/controller/game_controller
if(!kill_air)
src.set_debug_state("Air Master")
air_master.current_cycle++
var/success = air_master.tick() //Changed so that a runtime does not crash the ticker.
if(!success) //Runtimed.
world << "<font color='red'><b>ERROR IN ATMOS TICKER. Killing air simulation!</font></b>"
+9 -1
View File
@@ -322,7 +322,7 @@
/obj/structure/window/Del()
density = 0
update_nearby_tiles()
update_nearby_tiles(need_rebuild=1)
playsound(src, "shatter", 70, 1)
@@ -343,6 +343,14 @@
//This proc has to do with airgroups and atmos, it has nothing to do with smoothwindows, that's update_nearby_tiles().
/obj/structure/window/proc/update_nearby_tiles(need_rebuild)
if(!air_master) return 0
if(!dir in cardinal)
var/turf/simulated/source = get_turf(src)
if(istype(source))
air_master.tiles_to_update |= source
for(var/dir in cardinal)
var/turf/simulated/target = get_step(source,dir)
if(istype(target)) air_master.tiles_to_update |= target
return 1
var/turf/simulated/source = get_turf(src)
var/turf/simulated/target = get_step(source,dir)