From ccaef844bfef3151fa812626a4ec37408556e1c5 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Fri, 10 Jan 2014 16:40:06 -0700 Subject: [PATCH] Fixes derpiness with ZAS heat transfer. --- code/ZAS/Variable Settings.dm | 5 +++-- code/ZAS/ZAS_Zones.dm | 14 +++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/code/ZAS/Variable Settings.dm b/code/ZAS/Variable Settings.dm index 5dd951fe52e..29463a86900 100644 --- a/code/ZAS/Variable Settings.dm +++ b/code/ZAS/Variable Settings.dm @@ -65,9 +65,9 @@ var/global/vs_control/vsc = new var/airflow_mob_slowdown_NAME = "Airflow Slowdown" var/airflow_mob_slowdown_DESC = "Time in tenths of a second to add as a delay to each movement by a mob if they are fighting the pull of the airflow." - var/connection_insulation = 1 + var/connection_insulation = 0 var/connection_insulation_NAME = "Connections - Insulation" - var/connection_insulation_DESC = "How insulative a connection is, in terms of heat transfer. 1 is perfectly insulative, and 0 is perfectly conductive." + var/connection_insulation_DESC = "Boolean, should zones conduct heat through doors?" var/connection_temperature_delta = 10 var/connection_temperature_delta_NAME = "Connections - Temperature Difference" @@ -288,6 +288,7 @@ var/global/vs_control/vsc = new airflow_speed_decay = 1 airflow_delay = 20 airflow_mob_slowdown = 3 + connection_insulation = 1 world << "\blue [key_name(user)] changed the global plasma/ZAS settings to \"[def]\"" diff --git a/code/ZAS/ZAS_Zones.dm b/code/ZAS/ZAS_Zones.dm index eb7b05079c7..34c57d9cb03 100644 --- a/code/ZAS/ZAS_Zones.dm +++ b/code/ZAS/ZAS_Zones.dm @@ -654,6 +654,18 @@ proc/ShareSpace(datum/gas_mixture/A, list/unsimulated_tiles, dbg_output) proc/ShareHeat(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles) + //This implements a simplistic version of the Stefan-Boltzmann law. + var/energy_delta = ((A.temperature - B.temperature) ** 4) * 5.6704e-8 * connecting_tiles + var/maximum_energy_delta = max(0, min(A.temperature * A.heat_capacity() * A.group_multiplier, B.temperature * B.heat_capacity() * B.group_multiplier)) + if(maximum_energy_delta > abs(energy_delta)) + if(energy_delta < 0) + maximum_energy_delta *= -1 + energy_delta = maximum_energy_delta + + A.temperature -= energy_delta / (A.heat_capacity() * A.group_multiplier) + B.temperature += energy_delta / (B.heat_capacity() * B.group_multiplier) + + /* This was bad an I feel bad. //Shares a specific ratio of gas between mixtures using simple weighted averages. var //WOOT WOOT TOUCH THIS AND YOU ARE A RETARD @@ -676,7 +688,7 @@ proc/ShareHeat(datum/gas_mixture/A, datum/gas_mixture/B, connecting_tiles) A.temperature = max(0, (A.temperature - temp_avg) * (1- (ratio / max(1,A.group_multiplier)) ) + temp_avg ) B.temperature = max(0, (B.temperature - temp_avg) * (1- (ratio / max(1,B.group_multiplier)) ) + temp_avg ) - + */ /////////////////// //Zone Rebuilding//