diff --git a/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm b/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm index d7b11cf5fa7e0..6397a6ac5a5bd 100644 --- a/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm +++ b/code/FEA/DEBUG_REMOVE_BEFORE_RELEASE.dm @@ -480,6 +480,7 @@ obj/indicator Click() process() + obj/window verb destroy() @@ -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) diff --git a/code/FEA/FEA_airgroup.dm b/code/FEA/FEA_airgroup.dm index 50f7f571df751..8237ab0bd0216 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() @@ -39,6 +43,8 @@ datum suspend_group_processing() update_tiles_from_group() group_processing = 0 + 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() @@ -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 7bb68e2cb7192..20c0a8e3b25a1 100644 --- a/code/FEA/FEA_fire.dm +++ b/code/FEA/FEA_fire.dm @@ -39,6 +39,9 @@ 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 diff --git a/code/FEA/FEA_turf_tile.dm b/code/FEA/FEA_turf_tile.dm index bc210bead8284..5c97a14972774 100644 --- a/code/FEA/FEA_turf_tile.dm +++ b/code/FEA/FEA_turf_tile.dm @@ -61,6 +61,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() @@ -80,6 +84,18 @@ turf pressure_difference = connection_difference pressure_direction = connection_direction + if (istype(src,/turf/simulated)) + //P=nRT/V + var/turf/simulated/me = src + var/min_pressure = MINIMUM_AIR_TO_SUSPEND*me.air.temperature*R_IDEAL_GAS_EQUATION/CELL_VOLUME + if (connection_difference > min_pressure) + //enough air moved, reset wait + me.reset_delay() + //reset neighbor too + var/turf/simulated/enemy_tile = get_step(src, connection_direction) + if(istype(enemy_tile)) + enemy_tile.reset_delay() + simulated proc consider_pressure_difference_space(connection_difference) @@ -90,8 +106,11 @@ turf air_master.high_pressure_delta += src pressure_direction = direction pressure_difference = connection_difference + + return 1 + turf simulated @@ -127,6 +146,7 @@ turf mimic_temperature_with_tile(turf/model) share_temperature_with_tile(turf/simulated/sharer) + super_conduct() update_visuals(datum/gas_mixture/model) @@ -194,6 +214,9 @@ turf parent.suspend_group_processing() air.merge(giver) else + if (giver.total_moles() > MINIMUM_AIR_TO_SUSPEND) + reset_delay() + air.merge(giver) if(!processing) @@ -297,6 +320,13 @@ turf processing = 0 process_cell() + //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 @@ -542,3 +572,8 @@ turf being_superconductive = 1 air_master.active_super_conductivity += src + + proc/reset_delay() + //sets this turf to process quickly again + next_check=0 + check_delay=0 diff --git a/code/game/objects/alien/resin.dm b/code/game/objects/alien/resin.dm index c32cca2c98748..84d74bc524bd8 100644 --- a/code/game/objects/alien/resin.dm +++ b/code/game/objects/alien/resin.dm @@ -158,3 +158,9 @@ for(var/mob/O in viewers(src, 3)) O.show_message(text("\red An alien larva bursts from the resin wall!"), 1, text("\red You hear a high, alien screech nearby!"), 2) return + +/obj/alien/resin/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) + if(air_group) return 0 + if(istype(mover) && mover.checkpass(PASSGLASS)) + return !opacity + return !density