From 890491da614cb89486676ae815eb27c922bfdb2d Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Fri, 10 Jan 2014 16:38:08 -0700 Subject: [PATCH 1/3] Fixes ZAS silliness with SoftDelete --- code/ZAS/ZAS_Zones.dm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/code/ZAS/ZAS_Zones.dm b/code/ZAS/ZAS_Zones.dm index 783d8d617f..eb7b05079c 100644 --- a/code/ZAS/ZAS_Zones.dm +++ b/code/ZAS/ZAS_Zones.dm @@ -114,12 +114,17 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs //Removing zone connections and scheduling connection cleanup for(var/zone/Z in connected_zones) Z.connected_zones.Remove(src) - Z.closed_connection_zones.Remove(src) + if(!Z.connected_zones.len) + Z.connected_zones = null + + if(Z.closed_connection_zones) + Z.closed_connection_zones.Remove(src) + if(!Z.closed_connection_zones.len) + Z.closed_connection_zones = null connected_zones = null closed_connection_zones = null - return 1 @@ -358,7 +363,7 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs for(var/zone/Z in closed_connection_zones) //If that zone has already processed, skip it. - if(Z.last_update > last_update) + if(Z.last_update > last_update || !Z.air) continue var/handle_temperature = abs(air.temperature - Z.air.temperature) > vsc.connection_temperature_delta From ccaef844bfef3151fa812626a4ec37408556e1c5 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Fri, 10 Jan 2014 16:40:06 -0700 Subject: [PATCH 2/3] 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 5dd951fe52..29463a8690 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 eb7b05079c..34c57d9cb0 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// From 9cae391e0e75bfdd249b58a6173f7351f443ed85 Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Fri, 10 Jan 2014 16:45:59 -0700 Subject: [PATCH 3/3] Adds developer-level access to ZAS settings. Fixes bug which would always let heat move through doors. --- code/ZAS/Debug.dm | 10 +++++++-- code/ZAS/Variable Settings.dm | 6 +++--- code/ZAS/ZAS_Zones.dm | 35 ++++++++++++++++--------------- code/modules/admin/admin_verbs.dm | 3 ++- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/code/ZAS/Debug.dm b/code/ZAS/Debug.dm index 5ac704cf9f..39f5a7caab 100644 --- a/code/ZAS/Debug.dm +++ b/code/ZAS/Debug.dm @@ -134,6 +134,7 @@ zone/proc/DebugDisplay(client/client) client/proc/TestZASRebuild() + set category = "Debug" // var/turf/turf = get_turf(mob) var/zone/current_zone = mob.loc:zone if(!current_zone) @@ -155,7 +156,7 @@ client/proc/TestZASRebuild() for(var/direction in cardinal) var/turf/simulated/adjacent = get_step(current, direction) - if(!current.ZAirPass(adjacent)) + if(!current.ZCanPass(adjacent)) continue if(turfs.Find(adjacent)) current_adjacents += adjacent @@ -210,4 +211,9 @@ client/proc/TestZASRebuild() for(var/turf/current in turfs) current.overlays -= overlays - return final_arrangement \ No newline at end of file + return final_arrangement + +/client/proc/ZASSettings() + set category = "Debug" + + vsc.SetDefault(mob) \ No newline at end of file diff --git a/code/ZAS/Variable Settings.dm b/code/ZAS/Variable Settings.dm index 29463a8690..92841a02dc 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 = 0 + var/connection_insulation = 1 var/connection_insulation_NAME = "Connections - Insulation" - var/connection_insulation_DESC = "Boolean, should zones conduct heat through doors?" + var/connection_insulation_DESC = "Boolean, should doors forbid heat transfer?" var/connection_temperature_delta = 10 var/connection_temperature_delta_NAME = "Connections - Temperature Difference" @@ -288,7 +288,7 @@ var/global/vs_control/vsc = new airflow_speed_decay = 1 airflow_delay = 20 airflow_mob_slowdown = 3 - connection_insulation = 1 + connection_insulation = 0 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 34c57d9cb0..b942d79350 100644 --- a/code/ZAS/ZAS_Zones.dm +++ b/code/ZAS/ZAS_Zones.dm @@ -361,25 +361,26 @@ var/list/CounterDoorDirections = list(SOUTH,EAST) //Which directions doors turfs Z.interactions_with_neighbors++ interactions_with_neighbors++ - for(var/zone/Z in closed_connection_zones) - //If that zone has already processed, skip it. - if(Z.last_update > last_update || !Z.air) - continue - - var/handle_temperature = abs(air.temperature - Z.air.temperature) > vsc.connection_temperature_delta - - if(Z.status == ZONE_SLEEPING) - if (handle_temperature) - Z.SetStatus(ZONE_ACTIVE) - else + if(!vsc.connection_insulation) + for(var/zone/Z in closed_connection_zones) + //If that zone has already processed, skip it. + if(Z.last_update > last_update || !Z.air) continue - if(air && Z.air) - if( handle_temperature ) - ShareHeat(air, Z.air, closed_connection_zones[Z]) + var/handle_temperature = abs(air.temperature - Z.air.temperature) > vsc.connection_temperature_delta - Z.interactions_with_neighbors++ - interactions_with_neighbors++ + if(Z.status == ZONE_SLEEPING) + if (handle_temperature) + Z.SetStatus(ZONE_ACTIVE) + else + continue + + if(air && Z.air) + if( handle_temperature ) + ShareHeat(air, Z.air, closed_connection_zones[Z]) + + Z.interactions_with_neighbors++ + interactions_with_neighbors++ if(!interactions_with_neighbors && !interactions_with_unsim) SetStatus(ZONE_SLEEPING) @@ -655,7 +656,7 @@ 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/energy_delta = ((A.temperature - B.temperature) ** 4) * 5.6704e-8 * connecting_tiles * 2.5 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) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 1196f14ebd..e7a3433541 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -72,7 +72,7 @@ var/list/admin_verbs_admin = list( /client/proc/response_team, // Response Teams admin verb /client/proc/toggle_antagHUD_use, /client/proc/toggle_antagHUD_restrictions, - /client/proc/allow_character_respawn /* Allows a ghost to respawn */ + /client/proc/allow_character_respawn /* Allows a ghost to respawn */ ) var/list/admin_verbs_ban = list( /client/proc/unban_panel, @@ -128,6 +128,7 @@ var/list/admin_verbs_debug = list( /client/proc/cmd_admin_list_open_jobs, /client/proc/Debug2, /client/proc/kill_air, + /client/proc/ZASSettings, /client/proc/cmd_debug_make_powernets, /client/proc/kill_airgroup, /client/proc/debug_controller,