From c4f6a66d3def27644acee8f45bdeace28c3d1b78 Mon Sep 17 00:00:00 2001 From: Aryn Date: Wed, 26 Feb 2014 08:16:52 -0700 Subject: [PATCH] Fixed nuke shuttle being a swirly vortex of death. This bug was actually in legacy ShareSpace code, I'm surprised it wasn't noticeable in the old ZAS. --- code/ZAS/ConnectionGroup.dm | 21 +++++++++++++++------ code/ZAS/Debug.dm | 2 ++ code/ZAS/Diagnostic.dm | 3 +++ code/ZAS/Zone.dm | 1 + 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/code/ZAS/ConnectionGroup.dm b/code/ZAS/ConnectionGroup.dm index 1486f5088b6..c31dbf9a034 100644 --- a/code/ZAS/ConnectionGroup.dm +++ b/code/ZAS/ConnectionGroup.dm @@ -190,7 +190,7 @@ Class Procs: A.edges.Add(src) air = B.return_air() //id = 52*A.id - //world << "New edge from [A.id] to [B]." + //world << "New edge from [A] to [B]." /connection_edge/unsimulated/add_connection(connection/c) . = ..() @@ -215,7 +215,7 @@ Class Procs: return //world << "[id]: Tick [air_master.current_cycle]: To [B]!" //A.air.mimic(B, coefficient) - ShareSpace(A.air,air) + ShareSpace(A.air,air,dbg_out) air_master.mark_zone_update(A) var/differential = A.air.return_pressure() - air.return_pressure() @@ -333,6 +333,9 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output) share_size = max(1, max(size + 3, 1) + avg_unsim.group_multiplier) tileslen = avg_unsim.group_multiplier + if(dbg_output) + world << "O2: [unsim_oxygen] N2: [unsim_nitrogen] Size: [share_size] Tiles: [tileslen]" + else if(istype(unsimulated_tiles, /list)) if(!unsimulated_tiles.len) return 0 @@ -376,10 +379,10 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output) full_heat_capacity = A.heat_capacity() * size - oxy_avg = (full_oxy + unsim_oxygen) / (size + share_size) - nit_avg = (full_nitro + unsim_nitrogen) / (size + share_size) - co2_avg = (full_co2 + unsim_co2) / (size + share_size) - plasma_avg = (full_plasma + unsim_plasma) / (size + share_size) + oxy_avg = (full_oxy + unsim_oxygen*share_size) / (size + share_size) + nit_avg = (full_nitro + unsim_nitrogen*share_size) / (size + share_size) + co2_avg = (full_co2 + unsim_co2*share_size) / (size + share_size) + plasma_avg = (full_plasma + unsim_plasma*share_size) / (size + share_size) temp_avg = 0 @@ -389,6 +392,10 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output) if(sharing_lookup_table.len >= tileslen) //6 or more interconnecting tiles will max at 42% of air moved per tick. ratio = sharing_lookup_table[tileslen] + if(dbg_output) + world << "Ratio: [ratio]" + world << "Avg O2: [oxy_avg] N2: [nit_avg]" + A.oxygen = max(0, (A.oxygen - oxy_avg) * (1 - ratio) + oxy_avg ) A.nitrogen = max(0, (A.nitrogen - nit_avg) * (1 - ratio) + nit_avg ) A.carbon_dioxide = max(0, (A.carbon_dioxide - co2_avg) * (1 - ratio) + co2_avg ) @@ -402,6 +409,8 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output) A.update_values() + if(dbg_output) world << "Result: [abs(old_pressure - A.return_pressure())] kPa" + return abs(old_pressure - A.return_pressure()) diff --git a/code/ZAS/Debug.dm b/code/ZAS/Debug.dm index b27056f2384..6f0a67fd3eb 100644 --- a/code/ZAS/Debug.dm +++ b/code/ZAS/Debug.dm @@ -7,6 +7,8 @@ var/image/zone_blocked = image('icons/Testing/Zone.dmi', icon_state = "zoneblock var/image/blocked = image('icons/Testing/Zone.dmi', icon_state = "fullblock") var/image/mark = image('icons/Testing/Zone.dmi', icon_state = "mark") +/connection_edge/var/dbg_out = 0 + /turf/var/tmp/dbg_img /turf/proc/dbg(image/img, d = 0) if(d > 0) img.dir = d diff --git a/code/ZAS/Diagnostic.dm b/code/ZAS/Diagnostic.dm index 07f06a5514d..eb5d72788e2 100644 --- a/code/ZAS/Diagnostic.dm +++ b/code/ZAS/Diagnostic.dm @@ -17,6 +17,9 @@ client/proc/Zone_Info(turf/T as null|turf) T:zone:dbg_data(src) else mob << "No zone here." + var/datum/gas_mixture/mix = T.return_air() + mob << "[mix.return_pressure()] kPa [mix.temperature]C" + mob << "O2: [mix.oxygen] N2: [mix.nitrogen] CO2: [mix.carbon_dioxide] TX: [mix.toxins]" else if(zone_debug_images) for(var/zone in zone_debug_images) diff --git a/code/ZAS/Zone.dm b/code/ZAS/Zone.dm index 17d6097cdaf..349d0e0582f 100644 --- a/code/ZAS/Zone.dm +++ b/code/ZAS/Zone.dm @@ -145,6 +145,7 @@ Class Procs: else space_edges++ space_coefficient += E.coefficient + M << "[E:air:return_pressure()]kPa" M << "Zone Edges: [zone_edges]" M << "Space Edges: [space_edges] ([space_coefficient] connections)"