From ae5ea54af1b1089cb2f8ede1e79cf159c28aedba Mon Sep 17 00:00:00 2001 From: Ren Erthilo Date: Tue, 10 Apr 2012 17:38:44 +0100 Subject: [PATCH] Reverts ZAS This reverts commit fd09ea6ce82bd3c50b1f05bd784f4c07dfd2b675. and https://github.com/Baystation12/Baystation12/pull/681 --- 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/ZAS/Processing.dm | 4 +- code/defines/procs/helpers.dm | 6 +- 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 | 3 +- code/modules/admin/verbs/diagnostics.dm | 4 +- code/setup.dm | 2 - 22 files changed, 248 insertions(+), 347 deletions(-) diff --git a/baystation12.dme b/baystation12.dme index 344c54397e..6e3fe298fc 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -350,6 +350,7 @@ #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" @@ -1128,16 +1129,6 @@ #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 \ No newline at end of file +// 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 5dd2105af6..457187137f 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -77,8 +77,6 @@ var/datum/gas_mixture/removed = air1.remove(transfer_moles) - if(istype(removed)) - AirflowRepel(loc,removed.return_pressure()) loc.assume_air(removed) if(network1) @@ -97,8 +95,6 @@ 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 1bba19a9f0..ab199d92d0 100644 --- a/code/ATMOSPHERICS/components/unary/outlet_injector.dm +++ b/code/ATMOSPHERICS/components/unary/outlet_injector.dm @@ -40,9 +40,6 @@ var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) - if(istype(removed)) - AirflowRepel(loc,removed.return_pressure()) - loc.assume_air(removed) if(network) @@ -61,9 +58,6 @@ 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 e8a95516f2..03a79934b0 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -94,9 +94,6 @@ var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) - if(istype(removed)) - AirflowRepel(loc,removed.return_pressure()) - loc.assume_air(removed) if(network) @@ -112,10 +109,8 @@ 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()) + var/datum/gas_mixture/removed = loc.remove_air(transfer_moles) 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 1cb0975e9e..a55e38140b 100644 --- a/code/ATMOSPHERICS/components/unary/vent_scrubber.dm +++ b/code/ATMOSPHERICS/components/unary/vent_scrubber.dm @@ -127,8 +127,6 @@ //Remix the resulting gases - if(istype(removed)) - AirflowAttract(loc,filtered_out.return_pressure()) air_contents.merge(filtered_out) loc.assume_air(removed) @@ -144,9 +142,6 @@ 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 a43e76c483..ed68cce383 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/meteor/M = new( src ) + var/obj/effect/meteor/M = new( src ) walk(M, direction,10) @@ -480,6 +480,7 @@ obj/indicator Click() process() + obj/window verb destroy() @@ -514,7 +515,7 @@ mob fire_report() set category = "Debug" usr << "\b \red Fire Report" - for(var/obj/hotspot/flame in world) + for(var/obj/effect/hotspot/flame in world) usr << "[flame.x],[flame.y]: [flame.temperature]K, [flame.volume] L - [flame.loc:air:temperature]" process_cycle() @@ -550,6 +551,52 @@ 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) @@ -582,23 +629,16 @@ 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]" - 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 +/* 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)*/ diff --git a/code/FEA/FEA_airgroup.dm b/code/FEA/FEA_airgroup.dm index edeaa4a2fd..c31ab6f503 100644 --- a/code/FEA/FEA_airgroup.dm +++ b/code/FEA/FEA_airgroup.dm @@ -9,6 +9,10 @@ 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() @@ -37,8 +41,10 @@ datum var/length_space_border = 0 suspend_group_processing() - update_tiles_from_group() group_processing = 0 + update_tiles_from_group() + check_delay=0 + next_check=0 update_group_from_tiles() var/sample_member = pick(members) @@ -52,6 +58,9 @@ 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() @@ -65,7 +74,7 @@ datum var/turf/simulated/sample = pick(members) for(var/member in members) - if(locate(/obj/effect/hotspot) in member) + if(member:active_hotspot) return 0 if(member:air.compare(sample.air)) continue else @@ -79,6 +88,13 @@ 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 422f28f72b..675b70441f 100644 --- a/code/FEA/FEA_fire.dm +++ b/code/FEA/FEA_fire.dm @@ -39,10 +39,13 @@ 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 - hotspot + effect/hotspot //Icon for fire on turfs, also helps for nurturing small fires until they are full tile anchored = 1 @@ -92,7 +95,7 @@ obj for(var/atom/item in loc) item.temperature_expose(null, temperature, volume) - proc/process(turf/simulated/list/possible_spread) + process(turf/simulated/list/possible_spread) if(just_spawned) just_spawned = 0 return 0 @@ -129,6 +132,12 @@ 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*/ @@ -144,6 +153,22 @@ obj if (istype(loc, /turf/simulated)) var/turf/simulated/T = loc loc:active_hotspot = null - src.ul_SetLuminosity(0) + 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 ..() \ No newline at end of file diff --git a/code/FEA/FEA_gas_mixture.dm b/code/FEA/FEA_gas_mixture.dm index 9de87065b9..d43c88dabb 100644 --- a/code/FEA/FEA_gas_mixture.dm +++ b/code/FEA/FEA_gas_mixture.dm @@ -68,8 +68,6 @@ 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() @@ -79,8 +77,6 @@ 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() @@ -121,7 +117,7 @@ datum return graphic != graphic_archived - react(atom/dump_location,canburn = 1) + react(atom/dump_location) var/reacting = 0 //set to 1 if a notable reaction occured (used by pipe_network) if(trace_gases.len > 0) @@ -141,10 +137,9 @@ datum reacting = 1 fuel_burnt = 0 - if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST && canburn) + if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) //world << "pre [temperature], [oxygen], [toxins]" - //if(fire() > 0) - if(zburn() > 0) + if(fire() > 0) reacting = 1 //world << "post [temperature], [oxygen], [toxins]" @@ -240,11 +235,6 @@ 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 @@ -698,128 +688,6 @@ 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 3a4835e0c6..c803d6ef95 100644 --- a/code/FEA/FEA_group_helpers.dm +++ b/code/FEA/FEA_group_helpers.dm @@ -68,44 +68,31 @@ // world << "[north_votes], [south_votes], [east_votes]" + var/datum/air_group/group_joined = null + if(west) if(west.parent) - west.parent.suspend_group_processing() - west.parent.members += src - parent = west.parent - - air_master.tiles_to_update += west.parent.members - return 1 - + group_joined = west.parent else new_group_possible = 1 if(north_votes && (north_votes >= south_votes) && (north_votes >= east_votes)) - north.parent.suspend_group_processing() - north.parent.members += src - parent = north.parent + group_joined = north.parent + else if(south_votes && (south_votes >= east_votes)) + group_joined = south.parent + else if(east_votes) + group_joined = east.parent - air_master.tiles_to_update += north.parent.members + 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 return 1 - - 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) + else 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 c4c8eb9be4..5be14387a7 100644 --- a/code/FEA/FEA_system.dm +++ b/code/FEA/FEA_system.dm @@ -152,13 +152,11 @@ 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.zone && S.z < 5) - new/zone(S) + if(!S.blocks_air && !S.parent && S.z < 5) // Added last check to force skipping asteroid z-levels -- TLE + assemble_group_turf(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) @@ -169,8 +167,6 @@ 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 @@ -221,7 +217,7 @@ datum base.processing = 0 //singletons at startup are technically unconnected anyway base.parent = null - if(base.air.check_tile_graphic()) + if(base.air && base.air.check_tile_graphic()) base.update_visuals(base.air) return null @@ -275,15 +271,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 @@ -333,8 +329,8 @@ datum AG.process_group() process_singletons() - for(var/item in active_singletons) - item:process_cell() + for(var/turf/simulated/T in active_singletons) + T.process_cell() process_super_conductivity() for(var/turf/simulated/hot_potato in active_super_conductivity) @@ -344,4 +340,4 @@ datum for(var/turf/pressurized in high_pressure_delta) pressurized.high_pressure_movements() - high_pressure_delta.len = 0 \ No newline at end of file + high_pressure_delta.len = 0 diff --git a/code/FEA/FEA_turf_tile.dm b/code/FEA/FEA_turf_tile.dm index 350e6073a0..f42b071991 100644 --- a/code/FEA/FEA_turf_tile.dm +++ b/code/FEA/FEA_turf_tile.dm @@ -46,6 +46,10 @@ 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() @@ -75,8 +79,11 @@ turf air_master.high_pressure_delta += src pressure_direction = direction pressure_difference = connection_difference + + return 1 + turf simulated @@ -95,7 +102,7 @@ turf archived_cycle = 0 current_cycle = 0 - obj/hotspot/active_hotspot + obj/effect/hotspot/active_hotspot temperature_archived //USED ONLY FOR SOLIDS being_superconductive = 0 @@ -112,11 +119,16 @@ turf mimic_temperature_with_tile(turf/model) share_temperature_with_tile(turf/simulated/sharer) + super_conduct() update_visuals(datum/gas_mixture/model) overlays = null - if(!model) return + + var/siding_icon_state = return_siding_icon_state() + if(siding_icon_state) + overlays += image('floors.dmi',siding_icon_state) + switch(model.graphic) if("plasma") overlays.Add(plmaster) @@ -143,16 +155,6 @@ 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 @@ -162,24 +164,15 @@ 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) - var/obj/fire/F = locate() in src - if(F) - del(F) + if(active_hotspot) + del(active_hotspot) if(blocks_air) for(var/direction in list(NORTH, SOUTH, EAST, WEST)) var/turf/simulated/tile = get_step(src,direction) @@ -188,9 +181,22 @@ turf ..() assume_air(datum/gas_mixture/giver) - if(air) - if(zone) - zone.air.merge(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) return 1 @@ -210,16 +216,29 @@ turf return air.mimic(T) return_air() - if(zone) - return zone.air + if(air) + if(parent&&parent.group_processing) + return parent.air + else return air else return ..() remove_air(amount as num) - var/datum/gas_mixture/removed = null - if(zone) - removed = zone.air.remove(amount) + 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) return removed @@ -233,30 +252,6 @@ 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 @@ -300,6 +295,18 @@ 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() @@ -310,20 +317,31 @@ turf var/turf/simulated/enemy_tile = get_step(src, direction) var/connection_difference = 0 - if(istype(enemy_tile)) + if(istype(enemy_tile)) //enemy_tile == neighbor, btw 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(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.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 @@ -361,6 +379,10 @@ 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) @@ -368,6 +390,7 @@ 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) @@ -513,7 +536,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) + if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER && heat_capacity && sharer.heat_capacity) var/heat = conduction_coefficient*delta_temperature* \ (heat_capacity*sharer.heat_capacity/(heat_capacity+sharer.heat_capacity)) @@ -527,15 +550,23 @@ turf return 0 if(air) - if(starting && air.temperature < MINIMUM_TEMPERATURE_START_SUPERCONDUCTION) return 0 - if(air.temperature < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) return 0 + if(air.temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) + return 0 if(air.heat_capacity() < MOLES_CELLSTANDARD*0.1*0.05) return 0 else - if(starting && temperature < MINIMUM_TEMPERATURE_START_SUPERCONDUCTION) return 0 - if(temperature < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) + if(temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) return 0 being_superconductive = 1 - air_master.active_super_conductivity += src \ No newline at end of file + 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() diff --git a/code/ZAS/Processing.dm b/code/ZAS/Processing.dm index 4de6c93986..8c799ef15a 100644 --- a/code/ZAS/Processing.dm +++ b/code/ZAS/Processing.dm @@ -3,9 +3,7 @@ var/explosion_halt = 0 zone proc/process() if(rebuild) - if(!contents.len) - del src - return 0 + if(!contents) del src var turf/sample = pick(contents) list/new_contents = FloodFill(sample) diff --git a/code/defines/procs/helpers.dm b/code/defines/procs/helpers.dm index 0a1cb2f965..389e79d15d 100644 --- a/code/defines/procs/helpers.dm +++ b/code/defines/procs/helpers.dm @@ -1472,8 +1472,6 @@ proc/listclearnulls(list/list) air_master.groups_to_rebuild += T1.parent else air_master.tiles_to_update += T1 - if(T1.zone) - T1.zone.space_tiles.len = 0 if(fromupdate.len) for(var/turf/simulated/T2 in fromupdate) @@ -1483,8 +1481,6 @@ proc/listclearnulls(list/list) air_master.groups_to_rebuild += T2.parent else air_master.tiles_to_update += T2 - if(T2.zone) - T2.zone.space_tiles.len = 0 for(var/obj/O in doors) O:update_nearby_tiles(1) @@ -1591,4 +1587,4 @@ proc/get_opposite(var/checkdir) var/a = copytext(text,i,i+1) if(a == character) count++ - return count + return count diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm index c8f4308370..6b9964fec4 100644 --- a/code/game/machinery/atmoalter/canister.dm +++ b/code/game/machinery/atmoalter/canister.dm @@ -86,7 +86,6 @@ if (src.health <= 10) var/atom/location = src.loc - AirflowRepel(location,air_contents.return_pressure()) location.assume_air(air_contents) src.destroyed = 1 @@ -129,8 +128,6 @@ 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 21c93a9985..4c83f8a76f 100644 --- a/code/game/machinery/atmoalter/pump.dm +++ b/code/game/machinery/atmoalter/pump.dm @@ -43,8 +43,6 @@ 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() @@ -60,8 +58,7 @@ 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 3a103b71c4..9aa0d7e821 100644 --- a/code/game/machinery/atmoalter/scrubber.dm +++ b/code/game/machinery/atmoalter/scrubber.dm @@ -37,8 +37,6 @@ 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 3e7338875d..5831e9d6a8 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 b3269c70dd..7c94e22f39 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -1857,16 +1857,6 @@ var/global/BSACooldown = 0 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) @@ -2094,13 +2084,7 @@ var/global/BSACooldown = 0 if(lvl >= 5) dat += "Create Mob
" // if(lvl == 6 ) - if(lvl >= 3 ) - dat += "
Edit Airflow Settings
" - dat += "Edit Plasma Settings
" - - dat += "
Load Settings
" - dat += "Save Settings
" - usr << browse(dat, "window=admin2;size=210x340") + usr << browse(dat, "window=admin2;size=210x180") return /* /obj/admins/proc/goons() diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 69986b0da0..da70a3a107 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -226,7 +226,6 @@ 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 @@ -917,4 +916,4 @@ C.CarbonCopy2(NewObj) else NewObj.vars[V] = vars[V] - return NewObj \ No newline at end of file + return NewObj diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm index d3c1690e5c..3722cf009c 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/fire/fire in world) + for(var/obj/effect/hotspot/hotspot 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(locate(/obj/fire) in T) + if(T.active_hotspot) 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 43a73c5fdc..b2ea776146 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -131,8 +131,6 @@ var/MAX_EXPLOSION_RANGE = 14 #define BLOCKHAIR 32768 // temporarily removes the user's hair icon -#define PLASMAGUARD 65536 - //flags for pass_flags #define PASSTABLE 1 #define PASSGLASS 2