From 4861e100be256b417be808aac2e3976f69b7b712 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Mar 2012 22:40:00 +0000 Subject: [PATCH] Zoned Atmos System, merged properly from aryn's repo. - Explosive (de)compression, breaches are much more fun! - Improved fire - Faster system, with less splitting Signed-off-by: unknown --- baystation12.dme | 13 +- .../components/binary_devices/dp_vent_pump.dm | 4 + .../components/unary/outlet_injector.dm | 6 + .../components/unary/vent_pump.dm | 7 +- .../components/unary/vent_scrubber.dm | 5 + code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm | 82 +++------ code/FEA/FEA_airgroup.dm | 20 +-- code/FEA/FEA_fire.dm | 31 +--- code/FEA/FEA_gas_mixture.dm | 138 ++++++++++++++- code/FEA/FEA_group_helpers.dm | 45 +++-- code/FEA/FEA_system.dm | 34 ++-- code/FEA/FEA_turf_tile.dm | 157 +++++++----------- code/game/machinery/atmoalter/canister.dm | 3 + code/game/machinery/atmoalter/pump.dm | 5 +- code/game/machinery/atmoalter/scrubber.dm | 2 + code/game/machinery/atmoalter/zvent.dm | 6 +- code/modules/admin/admin.dm | 18 +- code/modules/admin/admin_verbs.dm | 1 + code/modules/admin/verbs/diagnostics.dm | 4 +- code/setup.dm | 2 + 20 files changed, 339 insertions(+), 244 deletions(-) diff --git a/baystation12.dme b/baystation12.dme index c7cc913557b..9cda411201c 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -161,6 +161,7 @@ #define FILE_DIR "code/WorkInProgress/mapload" #define FILE_DIR "code/WorkInProgress/Mini" #define FILE_DIR "code/WorkInProgress/Mloc" +#define FILE_DIR "code/WorkInProgress/Mloc/networking" #define FILE_DIR "code/WorkInProgress/organs" #define FILE_DIR "code/WorkInProgress/Ported" #define FILE_DIR "code/WorkInProgress/Ported/Abi79" @@ -171,6 +172,7 @@ #define FILE_DIR "code/WorkInProgress/Tastyfish" #define FILE_DIR "code/WorkInProgress/virus2" #define FILE_DIR "code/WorkInProgress/Wrongnumber" +#define FILE_DIR "code/ZAS" #define FILE_DIR "html" #define FILE_DIR "icons" #define FILE_DIR "icons/48x48" @@ -361,7 +363,6 @@ #include "code\defines\sd_procs\direction.dm" #include "code\defines\sd_procs\math.dm" #include "code\FEA\FEA_airgroup.dm" -#include "code\FEA\FEA_fire.dm" #include "code\FEA\FEA_gas_mixture.dm" #include "code\FEA\FEA_group_helpers.dm" #include "code\FEA\FEA_system.dm" @@ -1113,6 +1114,16 @@ #include "code\WorkInProgress\virus2\monkeydispensor.dm" #include "code\WorkInProgress\virus2\Prob.dm" #include "code\WorkInProgress\Wrongnumber\weldbackpack.dm" +#include "code\ZAS\Airflow.dm" +#include "code\ZAS\Connection.dm" +#include "code\ZAS\Creation.dm" +#include "code\ZAS\Debug.dm" +#include "code\ZAS\Definition.dm" +#include "code\ZAS\Fire.dm" +#include "code\ZAS\Functions.dm" +#include "code\ZAS\Plasma.dm" +#include "code\ZAS\Processing.dm" +#include "code\ZAS\Variable Settings.dm" #include "interface\skin.dmf" #include "maps\tgstation.2.0.8.dmm" // END_INCLUDE diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm index 457187137f6..5dd2105af67 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -77,6 +77,8 @@ var/datum/gas_mixture/removed = air1.remove(transfer_moles) + if(istype(removed)) + AirflowRepel(loc,removed.return_pressure()) loc.assume_air(removed) if(network1) @@ -95,6 +97,8 @@ var/transfer_moles = pressure_delta*air2.volume/(environment.temperature * R_IDEAL_GAS_EQUATION) var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) + if(istype(removed)) + AirflowAttract(loc,removed.return_pressure()) air2.merge(removed) diff --git a/code/ATMOSPHERICS/components/unary/outlet_injector.dm b/code/ATMOSPHERICS/components/unary/outlet_injector.dm index ab199d92d02..1bba19a9f03 100644 --- a/code/ATMOSPHERICS/components/unary/outlet_injector.dm +++ b/code/ATMOSPHERICS/components/unary/outlet_injector.dm @@ -40,6 +40,9 @@ var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) + if(istype(removed)) + AirflowRepel(loc,removed.return_pressure()) + loc.assume_air(removed) if(network) @@ -58,6 +61,9 @@ var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) + if(istype(removed)) + AirflowRepel(loc,removed.return_pressure()) + loc.assume_air(removed) if(network) diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index 03a79934b0c..e8a95516f2d 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -94,6 +94,9 @@ var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) + if(istype(removed)) + AirflowRepel(loc,removed.return_pressure()) + loc.assume_air(removed) if(network) @@ -109,8 +112,10 @@ if(pressure_delta > 0) if(environment.temperature > 0) var/transfer_moles = pressure_delta*air_contents.volume/(environment.temperature * R_IDEAL_GAS_EQUATION) - var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) + if(istype(removed)) + AirflowAttract(loc,removed.return_pressure()) + if (isnull(removed)) //in space return diff --git a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm index a55e38140b1..1cb0975e9e3 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -127,6 +127,8 @@ //Remix the resulting gases + if(istype(removed)) + AirflowAttract(loc,filtered_out.return_pressure()) air_contents.merge(filtered_out) loc.assume_air(removed) @@ -142,6 +144,9 @@ var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) + if(istype(removed)) + AirflowAttract(loc,removed.return_pressure()) + air_contents.merge(removed) if(network) diff --git a/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm b/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm index ed68cce383b..a43e76c4831 100644 --- a/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm +++ b/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm @@ -33,7 +33,7 @@ turf/space create_meteor(direction as num) set src in world - var/obj/effect/meteor/M = new( src ) + var/obj/meteor/M = new( src ) walk(M, direction,10) @@ -480,7 +480,6 @@ obj/indicator Click() process() - obj/window verb destroy() @@ -515,7 +514,7 @@ mob fire_report() set category = "Debug" usr << "\b \red Fire Report" - for(var/obj/effect/hotspot/flame in world) + for(var/obj/hotspot/flame in world) usr << "[flame.x],[flame.y]: [flame.temperature]K, [flame.volume] L - [flame.loc:air:temperature]" process_cycle() @@ -551,52 +550,6 @@ mob air_master.process_update_tiles() air_master.process_rebuild_select_groups() - mark_group_delay() - set category = "Debug" - if(!air_master) - usr << "Cannot find air_system" - return - - for(var/datum/air_group/group in air_master.air_groups) - group.marker = 0 - - for(var/turf/simulated/floor/S in world) - S.icon = 'turf_analysis.dmi' - if(S.parent) - if(S.parent.group_processing) - if (S.parent.check_delay < 2) - S.parent.marker=1 - else if (S.parent.check_delay < 5) - S.parent.marker=2 - else if (S.parent.check_delay < 15) - S.parent.marker=3 - else if (S.parent.check_delay < 30) - S.parent.marker=4 - else - S.parent.marker=5 - if(S.parent.borders && S.parent.borders.Find(S)) - S.icon_state = "on[S.parent.marker]_border" - else - S.icon_state = "on[S.parent.marker]" - - else - if (S.check_delay < 2) - S.icon_state= "on1_border" - else if (S.check_delay < 5) - S.icon_state= "on2_border" - else if (S.check_delay < 15) - S.icon_state= "on3_border" - else if (S.check_delay < 30) - S.icon_state= "on4_border" - else - S.icon_state = "suspended" - else - if(S.processing) - S.icon_state = "individual_on" - else - S.icon_state = "individual_off" - - mark_groups() set category = "Debug" if(!air_master) @@ -629,16 +582,23 @@ mob set category = "Debug" getbrokeninhands() +/* + for(var/obj/movable/floor/S in world) + S.icon = 'turf_analysis.dmi' + if(S.parent) + if(S.parent.group_processing) + if(S.parent.marker == 0) + S.parent.marker = rand(1,5) + if(S.parent.borders && S.parent.borders.Find(S)) + S.icon_state = "on[S.parent.marker]_border" + else + S.icon_state = "on[S.parent.marker]" -/* jump_to_dead_group() Currently in the normal admin commands but fits here - set category = "Debug" - if(!air_master) - usr << "Cannot find air_system" - return - - var/datum/air_group/dead_groups = list() - for(var/datum/air_group/group in air_master.air_groups) - if (!group.group_processing) - dead_groups += group - var/datum/air_group/dest_group = pick(dead_groups) - usr.loc = pick(dest_group.members)*/ + else + S.icon_state = "suspended" + else + if(S.processing) + S.icon_state = "individual_on" + else + S.icon_state = "individual_off" +*/ \ No newline at end of file diff --git a/code/FEA/FEA_airgroup.dm b/code/FEA/FEA_airgroup.dm index c31ab6f503a..edeaa4a2fde 100644 --- a/code/FEA/FEA_airgroup.dm +++ b/code/FEA/FEA_airgroup.dm @@ -9,10 +9,6 @@ datum //The use of archived cycle saves processing power by permitting the archiving step of FET // to be rolled into the updating step - //optimization vars - var/tmp/next_check = 0 //number of ticks before this group updates - var/tmp/check_delay = 10 //number of ticks between updates, starts fairly high to get boring groups out of the way - proc archive() @@ -41,10 +37,8 @@ datum var/length_space_border = 0 suspend_group_processing() - group_processing = 0 update_tiles_from_group() - check_delay=0 - next_check=0 + group_processing = 0 update_group_from_tiles() var/sample_member = pick(members) @@ -58,9 +52,6 @@ datum update_tiles_from_group() for(var/member in members) member:air.copy_from(air) - if (istype(member,/turf/simulated)) - var/turf/simulated/turfmem=member - turfmem.reset_delay() archive() air.archive() @@ -74,7 +65,7 @@ datum var/turf/simulated/sample = pick(members) for(var/member in members) - if(member:active_hotspot) + if(locate(/obj/effect/hotspot) in member) return 0 if(member:air.compare(sample.air)) continue else @@ -88,13 +79,6 @@ datum turf/process_group() current_cycle = air_master.current_cycle if(group_processing) //See if processing this group as a group - //check if we're skipping this tick - if (next_check > 0) - next_check-- - return 1 - next_check += check_delay + rand(0,check_delay/2) - check_delay++ - var/turf/simulated/list/border_individual = list() var/datum/air_group/list/border_group = list() diff --git a/code/FEA/FEA_fire.dm b/code/FEA/FEA_fire.dm index 675b70441fb..422f28f72bb 100644 --- a/code/FEA/FEA_fire.dm +++ b/code/FEA/FEA_fire.dm @@ -39,13 +39,10 @@ turf active_hotspot.just_spawned = (current_cycle < air_master.current_cycle) //remove just_spawned protection if no longer processing this cell - //start processing quickly if we aren't already - reset_delay() - return igniting obj - effect/hotspot + hotspot //Icon for fire on turfs, also helps for nurturing small fires until they are full tile anchored = 1 @@ -95,7 +92,7 @@ obj for(var/atom/item in loc) item.temperature_expose(null, temperature, volume) - process(turf/simulated/list/possible_spread) + proc/process(turf/simulated/list/possible_spread) if(just_spawned) just_spawned = 0 return 0 @@ -132,12 +129,6 @@ obj icon_state = "2" else icon_state = "1" - - if(temperature > location.max_fire_temperature_sustained) - location.max_fire_temperature_sustained = temperature - - if(temperature > location.heat_capacity) - location.to_be_destroyed = 1 /*if(prob(25)) location.ReplaceWithSpace() return 0*/ @@ -153,22 +144,6 @@ obj if (istype(loc, /turf/simulated)) var/turf/simulated/T = loc loc:active_hotspot = null - src.sd_SetLuminosity(0) - - - - if(T.to_be_destroyed) - var/chance_of_deletion - if (T.heat_capacity) //beware of division by zero - chance_of_deletion = T.max_fire_temperature_sustained / T.heat_capacity * 8 //there is no problem with prob(23456), min() was redundant --rastaf0 - else - chance_of_deletion = 100 - if(prob(chance_of_deletion)) - T.ReplaceWithSpace() - else - T.to_be_destroyed = 0 - T.max_fire_temperature_sustained = 0 - - loc = null + src.ul_SetLuminosity(0) ..() \ No newline at end of file diff --git a/code/FEA/FEA_gas_mixture.dm b/code/FEA/FEA_gas_mixture.dm index da7f9b79342..72db42b060c 100644 --- a/code/FEA/FEA_gas_mixture.dm +++ b/code/FEA/FEA_gas_mixture.dm @@ -68,6 +68,8 @@ datum for(var/datum/gas/trace_gas in trace_gases) heat_capacity += trace_gas.moles*trace_gas.specific_heat + heat_capacity = max(heat_capacity,0.001) + return heat_capacity heat_capacity_archived() @@ -77,6 +79,8 @@ datum for(var/datum/gas/trace_gas in trace_gases) heat_capacity_archived += trace_gas.moles_archived*trace_gas.specific_heat + heat_capacity_archived = max(heat_capacity_archived,0.001) + return heat_capacity_archived total_moles() @@ -117,7 +121,7 @@ datum return graphic != graphic_archived - react(atom/dump_location) + react(atom/dump_location,canburn = 1) var/reacting = 0 //set to 1 if a notable reaction occured (used by pipe_network) if(trace_gases.len > 0) @@ -137,9 +141,10 @@ datum reacting = 1 fuel_burnt = 0 - if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) + if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST && canburn) //world << "pre [temperature], [oxygen], [toxins]" - if(fire() > 0) + //if(fire() > 0) + if(zburn() > 0) reacting = 1 //world << "post [temperature], [oxygen], [toxins]" @@ -235,6 +240,11 @@ datum //Performs air sharing calculations between two gas_mixtures assuming only 1 boundary length //Return: amount of gas exchanged (+ if sharer received) + share_ratio(datum/gas_mixture/sharer,ratio) + share_volume(datum/gas_mixture/sharer,ratio) + //Because share() sucks ass at being efficient and I have no need to discover how much gas was + //transferred. Return: Whether the two gases are equal enough to be merged. + mimic(turf/model) //Similar to share(...), except the model is not modified //Return: amount of gas exchanged @@ -688,6 +698,128 @@ datum else return 0 + share_ratio(datum/gas_mixture/sharer,ratio) + var + size = max(1,group_multiplier) + share_size = max(1,sharer.group_multiplier) + + full_oxy = oxygen * size + full_nitro = nitrogen * size + full_co2 = carbon_dioxide * size + full_plasma = toxins * size + + full_thermal = thermal_energy() * size + + s_full_oxy = sharer.oxygen * share_size + s_full_nitro = sharer.nitrogen * share_size + s_full_co2 = sharer.carbon_dioxide * share_size + s_full_plasma = sharer.toxins * share_size + + s_full_thermal = sharer.thermal_energy() * share_size + + oxy_avg = (full_oxy + s_full_oxy) / (size + share_size) + nit_avg = (full_nitro + s_full_nitro) / (size + share_size) + co2_avg = (full_co2 + s_full_co2) / (size + share_size) + plasma_avg = (full_plasma + s_full_plasma) / (size + share_size) + + thermal_avg = (full_thermal + s_full_thermal) / (size+share_size) + + oxygen = (oxygen - oxy_avg) * (1-ratio) + oxy_avg + nitrogen = (nitrogen - nit_avg) * (1-ratio) + nit_avg + carbon_dioxide = (carbon_dioxide - co2_avg) * (1-ratio) + co2_avg + toxins = (toxins - plasma_avg) * (1-ratio) + plasma_avg + + sharer.oxygen = (sharer.oxygen - oxy_avg) * (1-ratio) + oxy_avg + sharer.nitrogen = (sharer.nitrogen - nit_avg) * (1-ratio) + nit_avg + sharer.carbon_dioxide = (sharer.carbon_dioxide - co2_avg) * (1-ratio) + co2_avg + sharer.toxins = (sharer.toxins - plasma_avg) * (1-ratio) + plasma_avg + + var + thermal = (full_thermal/size - thermal_avg) * (1-ratio) + thermal_avg + sharer_thermal = (s_full_thermal/share_size - thermal_avg) * (1-ratio) + thermal_avg + + temperature = thermal / heat_capacity() + + sharer.temperature = sharer_thermal / sharer.heat_capacity() + + for(var/datum/gas/G in trace_gases) + var/datum/gas/H = locate(G.type) in sharer.trace_gases + if(H) + var/G_avg = (G.moles*size + H.moles*share_size) / (size+share_size) + G.moles = (G.moles - G_avg) * (1-ratio) + G_avg + H.moles = (H.moles - G_avg) * (1-ratio) + G_avg + else + H = new G.type + sharer.trace_gases += H + var/G_avg = (G.moles*size) / (size+share_size) + G.moles = (G.moles - G_avg) * (1-ratio) + G_avg + H.moles = (H.moles - G_avg) * (1-ratio) + G_avg + + if(compare(sharer)) return 1 + else return 0 + + /* See? Now that's how it's done. */ + + share_volume(datum/gas_mixture/sharer,ratio) + //Bases the size on volume. + var + size = max(1,volume) + share_size = max(1,sharer.volume) + + full_oxy = oxygen * size + full_nitro = nitrogen * size + full_co2 = carbon_dioxide * size + full_plasma = toxins * size + + full_thermal = thermal_energy() * size + + s_full_oxy = sharer.oxygen * share_size + s_full_nitro = sharer.nitrogen * share_size + s_full_co2 = sharer.carbon_dioxide * share_size + s_full_plasma = sharer.toxins * share_size + + s_full_thermal = sharer.thermal_energy() * share_size + + oxy_avg = (full_oxy + s_full_oxy) / (size + share_size) + nit_avg = (full_nitro + s_full_nitro) / (size + share_size) + co2_avg = (full_co2 + s_full_co2) / (size + share_size) + plasma_avg = (full_plasma + s_full_plasma) / (size + share_size) + + thermal_avg = (full_thermal + s_full_thermal) / (size+share_size) + + oxygen = (oxygen - oxy_avg) * (1-ratio) + oxy_avg + nitrogen = (nitrogen - nit_avg) * (1-ratio) + nit_avg + carbon_dioxide = (carbon_dioxide - co2_avg) * (1-ratio) + co2_avg + toxins = (toxins - plasma_avg) * (1-ratio) + plasma_avg + + sharer.oxygen = (sharer.oxygen - oxy_avg) * (1-ratio) + oxy_avg + sharer.nitrogen = (sharer.nitrogen - nit_avg) * (1-ratio) + nit_avg + sharer.carbon_dioxide = (sharer.carbon_dioxide - co2_avg) * (1-ratio) + co2_avg + sharer.toxins = (sharer.toxins - plasma_avg) * (1-ratio) + plasma_avg + + var + thermal = (full_thermal/size - thermal_avg) * (1-ratio) + thermal_avg + sharer_thermal = (s_full_thermal/share_size - thermal_avg) * (1-ratio) + thermal_avg + + temperature = thermal / heat_capacity() + + sharer.temperature = sharer_thermal / sharer.heat_capacity() + + for(var/datum/gas/G in trace_gases) + var/datum/gas/H = locate(G.type) in sharer.trace_gases + if(H) + var/G_avg = (G.moles*size + H.moles*share_size) / (size+share_size) + G.moles = (G.moles - G_avg) * (1-ratio) + G_avg + H.moles = (H.moles - G_avg) * (1-ratio) + G_avg + else + H = new G.type + sharer.trace_gases += H + var/G_avg = (G.moles*size) / (size+share_size) + G.moles = (G.moles - G_avg) * (1-ratio) + G_avg + H.moles = (H.moles - G_avg) * (1-ratio) + G_avg + + return 1 + mimic(turf/model, border_multiplier) var/delta_oxygen = QUANTIZE(oxygen_archived - model.oxygen)/5 var/delta_carbon_dioxide = QUANTIZE(carbon_dioxide_archived - model.carbon_dioxide)/5 diff --git a/code/FEA/FEA_group_helpers.dm b/code/FEA/FEA_group_helpers.dm index c803d6ef95e..3a4835e0c6b 100644 --- a/code/FEA/FEA_group_helpers.dm +++ b/code/FEA/FEA_group_helpers.dm @@ -68,31 +68,44 @@ // world << "[north_votes], [south_votes], [east_votes]" - var/datum/air_group/group_joined = null - if(west) if(west.parent) - group_joined = west.parent + west.parent.suspend_group_processing() + west.parent.members += src + parent = west.parent + + air_master.tiles_to_update += west.parent.members + return 1 + else new_group_possible = 1 if(north_votes && (north_votes >= south_votes) && (north_votes >= east_votes)) - group_joined = north.parent - else if(south_votes && (south_votes >= east_votes)) - group_joined = south.parent - else if(east_votes) - group_joined = east.parent + north.parent.suspend_group_processing() + north.parent.members += src + parent = north.parent - if (istype(group_joined)) - if (group_joined.group_processing) - group_joined.suspend_group_processing() - group_joined.members += src - parent=group_joined - - air_master.tiles_to_update += group_joined.members + air_master.tiles_to_update += north.parent.members return 1 - else if(new_group_possible) + + if(south_votes && (south_votes >= east_votes)) + south.parent.suspend_group_processing() + south.parent.members += src + parent = south.parent + + air_master.tiles_to_update += south.parent.members + return 1 + + if(east_votes) + east.parent.suspend_group_processing() + east.parent.members += src + parent = east.parent + + air_master.tiles_to_update += east.parent.members + return 1 + + if(new_group_possible) air_master.assemble_group_turf(src) return 1 diff --git a/code/FEA/FEA_system.dm b/code/FEA/FEA_system.dm index 5be14387a74..c4c8eb9be47 100644 --- a/code/FEA/FEA_system.dm +++ b/code/FEA/FEA_system.dm @@ -152,11 +152,13 @@ datum var/start_time = world.timeofday for(var/turf/simulated/S in world) - if(!S.blocks_air && !S.parent && S.z < 5) // Added last check to force skipping asteroid z-levels -- TLE - assemble_group_turf(S) + //if(!S.blocks_air && !S.parent && S.z < 5) // Added last check to force skipping asteroid z-levels -- TLE + // assemble_group_turf(S) + if(!S.blocks_air && !S.zone && S.z < 5) + new/zone(S) for(var/turf/simulated/S in world) //Update all pathing and border information as well - if(S.z > 4) // Skipping asteroids -- TLE - continue + //if(S.z > 4) // Skipping asteroids -- TLE + // continue S.update_air_properties() /* for(var/obj/movable/floor/S in world) @@ -167,6 +169,8 @@ datum */ world << "\red \b Geometry processed in [(world.timeofday-start_time)/10] seconds!" + spawn zone_master.start() + assemble_group_turf(turf/simulated/base) var/list/turf/simulated/members = list(base) //Confirmed group members @@ -217,7 +221,7 @@ datum base.processing = 0 //singletons at startup are technically unconnected anyway base.parent = null - if(base.air && base.air.check_tile_graphic()) + if(base.air.check_tile_graphic()) base.update_visuals(base.air) return null @@ -271,15 +275,15 @@ datum if(groups_to_rebuild.len > 0) process_rebuild_select_groups() if(tiles_to_update.len > 0) process_update_tiles() - process_groups() - process_singletons() + //process_groups() + //process_singletons() - process_super_conductivity() - process_high_pressure_delta() + //process_super_conductivity() + //process_high_pressure_delta() - if(current_cycle%10==5) //Check for groups of tiles to resume group processing every 10 cycles - for(var/datum/air_group/AG in air_groups) - AG.check_regroup() + //if(current_cycle%10==5) //Check for groups of tiles to resume group processing every 10 cycles + // for(var/datum/air_group/AG in air_groups) + // AG.check_regroup() return 1 @@ -329,8 +333,8 @@ datum AG.process_group() process_singletons() - for(var/turf/simulated/T in active_singletons) - T.process_cell() + for(var/item in active_singletons) + item:process_cell() process_super_conductivity() for(var/turf/simulated/hot_potato in active_super_conductivity) @@ -340,4 +344,4 @@ datum for(var/turf/pressurized in high_pressure_delta) pressurized.high_pressure_movements() - high_pressure_delta.len = 0 + high_pressure_delta.len = 0 \ No newline at end of file diff --git a/code/FEA/FEA_turf_tile.dm b/code/FEA/FEA_turf_tile.dm index eca82110869..b7a9091e3f3 100644 --- a/code/FEA/FEA_turf_tile.dm +++ b/code/FEA/FEA_turf_tile.dm @@ -61,10 +61,6 @@ turf var/pressure_difference = 0 var/pressure_direction = 0 - //optimization vars - var/next_check = 0 //number of ticks before this tile updates - var/check_delay = 0 //number of ticks between updates - proc high_pressure_movements() @@ -94,11 +90,8 @@ turf air_master.high_pressure_delta += src pressure_direction = direction pressure_difference = connection_difference - - return 1 - turf simulated @@ -117,7 +110,7 @@ turf archived_cycle = 0 current_cycle = 0 - obj/effect/hotspot/active_hotspot + obj/hotspot/active_hotspot temperature_archived //USED ONLY FOR SOLIDS being_superconductive = 0 @@ -134,16 +127,11 @@ turf mimic_temperature_with_tile(turf/model) share_temperature_with_tile(turf/simulated/sharer) - super_conduct() update_visuals(datum/gas_mixture/model) overlays = null - - var/siding_icon_state = return_siding_icon_state() - if(siding_icon_state) - overlays += image('floors.dmi',siding_icon_state) - + if(!model) return switch(model.graphic) if("plasma") overlays.Add(plmaster) @@ -170,6 +158,16 @@ turf find_group() + spawn(1) + for(var/d in cardinal) + var/turf/T = get_step(src,d) + if(!T || !T.zone) continue + if(!zone) + zone = T.zone + zone.AddTurf(src) + else if(T.zone != zone) + ZConnect(src,T) + // air.parent = src //TODO DEBUG REMOVE else @@ -179,15 +177,24 @@ turf if(istype(target)) air_master.tiles_to_update.Add(target) + for(var/d in list(NORTH,EAST)) + var/turf/T = get_step(src,d) + if(!T || !T.zone) continue + ZDisconnect(T,get_step(src,get_dir(T,src))) + Del() if(air_master) + if(zone) + zone.rebuild = 1 + zone.RemoveTurf(src) if(parent) air_master.groups_to_rebuild.Add(parent) parent.members.Remove(src) else air_master.active_singletons.Remove(src) - if(active_hotspot) - del(active_hotspot) + var/obj/fire/F = locate() in src + if(F) + del(F) if(blocks_air) for(var/direction in list(NORTH, SOUTH, EAST, WEST)) var/turf/simulated/tile = get_step(src,direction) @@ -196,22 +203,9 @@ turf ..() assume_air(datum/gas_mixture/giver) - if(!giver) return 0 - var/datum/gas_mixture/receiver = air - if(istype(receiver)) - if(parent&&parent.group_processing) - if(!parent.air.check_then_merge(giver)) - parent.suspend_group_processing() - air.merge(giver) - else - if (giver.total_moles() > MINIMUM_AIR_TO_SUSPEND) - reset_delay() - - air.merge(giver) - - if(!processing) - if(air.check_tile_graphic()) - update_visuals(air) + if(air) + if(zone) + zone.air.merge(giver) return 1 @@ -231,29 +225,16 @@ turf return air.mimic(T) return_air() - if(air) - if(parent&&parent.group_processing) - return parent.air - else return air + if(zone) + return zone.air else return ..() remove_air(amount as num) - if(air) - var/datum/gas_mixture/removed = null - - if(parent&&parent.group_processing) - removed = parent.air.check_then_remove(amount) - if(!removed) - parent.suspend_group_processing() - removed = air.remove(amount) - else - removed = air.remove(amount) - - if(!processing) - if(air.check_tile_graphic()) - update_visuals(air) + var/datum/gas_mixture/removed = null + if(zone) + removed = zone.air.remove(amount) return removed @@ -267,6 +248,30 @@ turf if(CanPass(null, get_step(src,direction), 0, 0)) air_check_directions |= direction + if(zone) + for(var/direction in cardinal) + if(air_check_directions&direction) + + var/turf/simulated/T = get_step(src,direction) + if(T) + ZConnect(src,T) + else + var/turf/simulated/T = get_step(src,direction) + if(T) + ZDisconnect(src,T) + else if(air) + // there's no zone here, but there's air + // if there are no zones nearby either make a new zone! + + for(var/direction in cardinal) + if(air_check_directions&direction) + var/turf/simulated/T = get_step(src,direction) + if(T.zone) goto ZoneNearby + + new/zone(src) + + ZoneNearby: + if(parent) if(parent.borders) parent.borders -= src @@ -310,18 +315,6 @@ turf processing = 0 process_cell() - //this proc does all the heavy lifting for individual tile processing - //it shares with all of its neighbors, spreads fire, calls superconduction - //and doesn't afraid of anything - - //check if we're skipping this tick - if (next_check > 0) - next_check-- - return 1 - next_check += check_delay + rand(0,check_delay/2) - check_delay++ - - var/turf/simulated/list/possible_fire_spreads = list() if(processing) if(archived_cycle < air_master.current_cycle) //archive self if not already done archive() @@ -332,31 +325,20 @@ turf var/turf/simulated/enemy_tile = get_step(src, direction) var/connection_difference = 0 - if(istype(enemy_tile)) //enemy_tile == neighbor, btw + if(istype(enemy_tile)) if(enemy_tile.archived_cycle < archived_cycle) //archive bordering tile information if not already done enemy_tile.archive() - - if (air && enemy_tile.air) - var/delay_trigger = air.compare(enemy_tile.air) - if (!delay_trigger) //if compare() didn't return 1, air is different enough to trigger processing - reset_delay() - enemy_tile.reset_delay() - if(enemy_tile.parent && enemy_tile.parent.group_processing) //apply tile to group sharing - if(enemy_tile.parent.current_cycle < current_cycle) //if the group hasn't been archived, it could just be out of date + if(enemy_tile.parent.current_cycle < current_cycle) if(enemy_tile.parent.air.check_gas_mixture(air)) connection_difference = air.share(enemy_tile.parent.air) else enemy_tile.parent.suspend_group_processing() connection_difference = air.share(enemy_tile.air) //group processing failed so interact with individual tile - else if(enemy_tile.current_cycle < current_cycle) connection_difference = air.share(enemy_tile.air) - - if(active_hotspot) - possible_fire_spreads += enemy_tile else /* var/obj/movable/floor/movable_on_enemy = locate(/obj/movable/floor) in enemy_tile @@ -394,10 +376,6 @@ turf air.react() - if(active_hotspot) - if (!active_hotspot.process(possible_fire_spreads)) - return 0 - if(air.temperature > MINIMUM_TEMPERATURE_START_SUPERCONDUCTION) consider_superconductivity(starting = 1) @@ -405,7 +383,6 @@ turf update_visuals(air) if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) - reset_delay() //hotspots always process quickly hotspot_expose(air.temperature, CELL_VOLUME) for(var/atom/movable/item in src) item.temperature_expose(air, air.temperature, CELL_VOLUME) @@ -551,7 +528,7 @@ turf proc/share_temperature_mutual_solid(turf/simulated/sharer, conduction_coefficient) var/delta_temperature = (temperature_archived - sharer.temperature_archived) - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER && heat_capacity && sharer.heat_capacity) + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) var/heat = conduction_coefficient*delta_temperature* \ (heat_capacity*sharer.heat_capacity/(heat_capacity+sharer.heat_capacity)) @@ -565,23 +542,15 @@ turf return 0 if(air) - if(air.temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) - return 0 + if(starting && air.temperature < MINIMUM_TEMPERATURE_START_SUPERCONDUCTION) return 0 + if(air.temperature < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) return 0 if(air.heat_capacity() < MOLES_CELLSTANDARD*0.1*0.05) return 0 else - if(temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) + if(starting && temperature < MINIMUM_TEMPERATURE_START_SUPERCONDUCTION) return 0 + if(temperature < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) return 0 being_superconductive = 1 - air_master.active_super_conductivity += src - - proc/reset_delay() - //sets this turf to process quickly again - next_check=0 - check_delay= -5 //negative numbers mean a mandatory quick-update period - - //if this turf has a parent air group, suspend its processing - if (parent && parent.group_processing) - parent.suspend_group_processing() + air_master.active_super_conductivity += src \ No newline at end of file diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index 7cf86a03ed5..ae9b61d523b 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -86,6 +86,7 @@ if (src.health <= 10) var/atom/location = src.loc + AirflowRepel(location,air_contents.return_pressure()) location.assume_air(air_contents) src.destroyed = 1 @@ -128,6 +129,8 @@ if(holding) environment.merge(removed) else + if(istype(removed)) + AirflowRepel(loc,removed.return_pressure()) loc.assume_air(removed) src.update_icon() diff --git a/code/game/machinery/atmoalter/pump.dm b/code/game/machinery/atmoalter/pump.dm index 4c83f8a76fb..21c93a99859 100644 --- a/code/game/machinery/atmoalter/pump.dm +++ b/code/game/machinery/atmoalter/pump.dm @@ -43,6 +43,8 @@ if(holding) environment.merge(removed) else + if(istype(removed)) + AirflowRepel(loc,removed.return_pressure()) loc.assume_air(removed) else var/pressure_delta = target_pressure - air_contents.return_pressure() @@ -58,7 +60,8 @@ removed = environment.remove(transfer_moles) else removed = loc.remove_air(transfer_moles) - + if(istype(removed)) + AirflowAttract(loc,removed.return_pressure()) air_contents.merge(removed) //src.update_icon() diff --git a/code/game/machinery/atmoalter/scrubber.dm b/code/game/machinery/atmoalter/scrubber.dm index 9aa0d7e821a..3a103b71c4a 100644 --- a/code/game/machinery/atmoalter/scrubber.dm +++ b/code/game/machinery/atmoalter/scrubber.dm @@ -37,6 +37,8 @@ removed = environment.remove(transfer_moles) else removed = loc.remove_air(transfer_moles) + if(istype(removed)) + AirflowAttract(loc,removed.return_pressure()) //Filter it if (removed) diff --git a/code/game/machinery/atmoalter/zvent.dm b/code/game/machinery/atmoalter/zvent.dm index 5831e9d6a85..3e7338875dd 100644 --- a/code/game/machinery/atmoalter/zvent.dm +++ b/code/game/machinery/atmoalter/zvent.dm @@ -24,7 +24,7 @@ var/datum/gas_mixture/conn_air = zturf_conn.air //TODO: pop culture reference var/datum/gas_mixture/my_air = myturf.air if (istype(conn_air) && istype(my_air)) - if (!my_air.compare(conn_air)) - myturf.reset_delay() - zturf_conn.reset_delay() + //if (!my_air.compare(conn_air)) + // myturf.reset_delay() + // zturf_conn.reset_delay() my_air.share(conn_air) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 825bafc03c3..4d1daf2c65e 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -1754,6 +1754,16 @@ J.spawn_positions = -1 message_admins("[key_name_admin(usr)] has removed the cap on security officers.") return + if(href_list["vsc"]) + if ((src.rank in list( "Moderator", "Temporary Admin", "Admin Candidate", "Trial Admin", "Badmin", "Game Admin", "Game Master" ))) + if(href_list["vsc"] == "airflow") + vsc.ChangeSettingsDialog(usr,vsc.settings) + if(href_list["vsc"] == "plasma") + vsc.ChangeSettingsDialog(usr,vsc.plc.settings) + if(href_list["vsc"] == "load") + LoadTweaks() + if(href_list["vsc"] == "save") + SaveTweaks() if (href_list["rnd_max"]) for(var/obj/machinery/computer/rdconsole/C in world) for(var/datum/tech/T in C.files.known_tech) @@ -1974,7 +1984,13 @@ if(lvl >= 5) dat += "Create Mob
" // if(lvl == 6 ) - usr << browse(dat, "window=admin2;size=210x180") + if(lvl >= 3 ) + dat += "
Edit Airflow Settings
" + dat += "Edit Plasma Settings
" + + dat += "
Load Settings
" + dat += "Save Settings
" + usr << browse(dat, "window=admin2;size=210x340") return /* /obj/admins/proc/goons() diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index e73fb0c8a91..c3b820cffb6 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -223,6 +223,7 @@ verbs += /proc/release verbs += /client/proc/toggleprayers verbs += /client/proc/editappear + verbs += /client/proc/Zone_Info if (holder.level >= 2)//Admin Candidate******************************************************************** verbs += /client/proc/cmd_admin_add_random_ai_law diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm index 3722cf009c9..d3c1690e5c3 100644 --- a/code/modules/admin/verbs/diagnostics.dm +++ b/code/modules/admin/verbs/diagnostics.dm @@ -40,7 +40,7 @@ active_tiles += group.members.len var/hotspots = 0 - for(var/obj/effect/hotspot/hotspot in world) + for(var/obj/fire/fire in world) hotspots++ var/output = {"AIR SYSTEMS REPORT
@@ -74,7 +74,7 @@ var/burning = 0 if(istype(target, /turf/simulated)) var/turf/simulated/T = target - if(T.active_hotspot) + if(locate(/obj/fire) in T) burning = 1 usr << "\blue @[target.x],[target.y] ([GM.group_multiplier]): O:[GM.oxygen] T:[GM.toxins] N:[GM.nitrogen] C:[GM.carbon_dioxide] w [GM.temperature] Kelvin, [GM.return_pressure()] kPa [(burning)?("\red BURNING"):(null)]" diff --git a/code/setup.dm b/code/setup.dm index b7d49a7a7de..81d1f959e9d 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -117,6 +117,8 @@ #define BLOCKHAIR 32768 // temporarily removes the user's hair icon +#define PLASMAGUARD 65536 + //flags for pass_flags #define PASSTABLE 1 #define PASSGLASS 2