From ef38bc91bf8a9de20d968080ea84511685d3e0b1 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Thu, 18 Apr 2013 12:10:20 -0700 Subject: [PATCH] Fixed some bugs with ZAS closed connections Sped up air equalization between zones Fixed an issue where space tiles were not removed from the zone. Made ZAS debug functions accessible when the mapping verbs are toggled on. --- baystation12.dme | 1 + code/ZAS/Connection.dm | 5 ++-- code/ZAS/Debug.dm | 4 +-- code/ZAS/Functions.dm | 1 + code/ZAS/ZAS_Turfs.dm | 38 ++++++++++++++++++++++++++--- code/ZAS/ZAS_Zones.dm | 4 +-- code/modules/admin/verbs/mapping.dm | 2 ++ 7 files changed, 46 insertions(+), 9 deletions(-) diff --git a/baystation12.dme b/baystation12.dme index 4ad917169d6..62d3a6df985 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -1301,6 +1301,7 @@ #include "code\WorkInProgress\virus2\isolator.dm" #include "code\ZAS\Airflow.dm" #include "code\ZAS\Connection.dm" +#include "code\ZAS\Debug.dm" #include "code\ZAS\FEA_gas_mixture.dm" #include "code\ZAS\FEA_system.dm" #include "code\ZAS\Fire.dm" diff --git a/code/ZAS/Connection.dm b/code/ZAS/Connection.dm index 7dc8c655f63..bd8eb43787c 100644 --- a/code/ZAS/Connection.dm +++ b/code/ZAS/Connection.dm @@ -66,6 +66,9 @@ connection B.zone.connected_zones += A.zone B.zone.connected_zones[A.zone] = 1 + if(A.HasDoor(B) || B.HasDoor(A)) + indirect = CONNECTION_INDIRECT + else indirect = CONNECTION_CLOSED @@ -86,8 +89,6 @@ connection B.zone.closed_connection_zones += A.zone B.zone.closed_connection_zones[A.zone] = 1 - if(A.HasDoor(B) || B.HasDoor(A)) - indirect = CONNECTION_INDIRECT else world.log << "Attempted to create connection object for non-zone tiles: [T] -> [O]" del(src) diff --git a/code/ZAS/Debug.dm b/code/ZAS/Debug.dm index e4e07f5cd8a..9cde83e7e3a 100644 --- a/code/ZAS/Debug.dm +++ b/code/ZAS/Debug.dm @@ -1,5 +1,5 @@ -client/verb/Zone_Info(turf/T as null|turf) +client/proc/Zone_Info(turf/T as null|turf) set category = "Debug" if(T) if(T.zone) @@ -14,7 +14,7 @@ client/verb/Zone_Info(turf/T as null|turf) -client/verb/Test_ZAS_Connection(var/turf/simulated/T as turf) +client/proc/Test_ZAS_Connection(var/turf/simulated/T as turf) set category = "Debug" if(!istype(T)) return diff --git a/code/ZAS/Functions.dm b/code/ZAS/Functions.dm index 176545af585..3224b501776 100644 --- a/code/ZAS/Functions.dm +++ b/code/ZAS/Functions.dm @@ -109,6 +109,7 @@ proc/ZMerge(zone/A,zone/B) proc/ZConnect(turf/simulated/A,turf/simulated/B) //Connects two zones by forming a connection object representing turfs A and B. + //Make sure that if it's space, it gets added to unsimulated_tiles instead. if(!istype(B)) if(A.zone) diff --git a/code/ZAS/ZAS_Turfs.dm b/code/ZAS/ZAS_Turfs.dm index b6ebe6bd500..e058cea3537 100644 --- a/code/ZAS/ZAS_Turfs.dm +++ b/code/ZAS/ZAS_Turfs.dm @@ -181,9 +181,41 @@ turf // var/list/zone/adjacent_zones = list() if(air_check_directions&direction) //I can connect air in this direction - if(!CanPass(null, T, 0, 0)) //If either block air from a door - if(!CanPass(null, src, 0, 0)) //I block air, so I have a door. Forge a closed connection through me. - ZConnect(src, T) + if(!CanPass(null, T, 0, 0)) //If either block air, we must look to see if the adjacent turfs need rebuilt. + if(!T.CanPass(null, T, 0, 0)) //Target blocks air + var/turf/NT = get_step(T, direction) + if(istype(NT,/turf/simulated) && NT in zone.contents) + air_master.AddToConsiderRebuild(src,NT) + else if(istype(NT) && NT in zone.unsimulated_tiles) + var/consider_rebuild = 0 + for(var/d in cardinal) + var/turf/UT = get_step(NT,d) + if(istype(UT, /turf/simulated) && UT.zone == zone && UT.CanPass(null, NT, 0, 0)) //If we find a neighboring tile that is in the same zone, check if we need to rebuild + consider_rebuild = 1 + break + if(consider_rebuild) + air_master.AddToConsiderRebuild(src,NT) //Gotta check if we need to rebuild, dammit + else + zone.RemoveTurf(NT) //Not adjacent to anything, and unsimulated. Goodbye~ + + //To make a closed connection through closed door. + ZConnect(T, src) + + if(T.zone && !T.zone.rebuild) //I block air. + var/turf/NT = get_step(src, reverse_direction(direction)) + if(istype(NT,/turf/simulated) && (NT in T.zone.contents || (NT.zone && T in NT.zone.contents))) + air_master.AddToConsiderRebuild(T,NT) + else if(istype(NT) && NT in T.zone.unsimulated_tiles) + var/consider_rebuild = 0 + for(var/d in cardinal) + var/turf/UT = get_step(NT,d) + if(istype(UT, /turf/simulated) && UT.zone == T.zone && UT.CanPass(null, NT, 0, 0)) //If we find a neighboring tile that is in the same zone, check if we need to rebuild + consider_rebuild = 1 + break + if(consider_rebuild) + air_master.AddToConsiderRebuild(T,NT) //Gotta check if we need to rebuild, dammit + else + T.zone.RemoveTurf(NT) //Not adjacent to anything, and unsimulated. Goodbye~ else ZConnect(src,T) diff --git a/code/ZAS/ZAS_Zones.dm b/code/ZAS/ZAS_Zones.dm index 66fd67d9605..d4e457ddc91 100644 --- a/code/ZAS/ZAS_Zones.dm +++ b/code/ZAS/ZAS_Zones.dm @@ -274,7 +274,7 @@ zone/proc/process() for(var/zone/Z in closed_connection_zones) if(air && Z.air) - if( abs(air.temperature - Z.air.temperature) > 50 ) + if( abs(air.temperature - Z.air.temperature) > 10 ) ShareHeat(air, Z.air, closed_connection_zones[Z]) progress = "all components completed successfully, the problem is not here" @@ -283,7 +283,7 @@ zone/proc/process() //Air Movement// //////////////// -var/list/sharing_lookup_table = list(0.08, 0.15, 0.21, 0.26, 0.30, 0.33) +var/list/sharing_lookup_table = list(0.15, 0.20, 0.24, 0.27, 0.30, 0.33) proc/ShareRatio(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles) //Shares a specific ratio of gas between mixtures using simple weighted averages. diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index 4c54b5bc072..af7f4f545e2 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -159,6 +159,8 @@ var/intercom_range_display_status = 0 src.verbs += /client/proc/kill_air_processing src.verbs += /client/proc/disable_communication src.verbs += /client/proc/disable_movement + src.verbs += /client/proc/Zone_Info + src.verbs += /client/proc/Test_ZAS_Connection //src.verbs += /client/proc/cmd_admin_rejuvenate feedback_add_details("admin_verb","mDV") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!