diff --git a/auxmos.dll b/auxmos.dll index 6422ddca5d..7d6949aa14 100644 Binary files a/auxmos.dll and b/auxmos.dll differ diff --git a/auxmos.pdb b/auxmos.pdb index 0731f4e6ba..261ef8e8cb 100644 Binary files a/auxmos.pdb and b/auxmos.pdb differ diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index bfa5e754b2..642c80109a 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -211,6 +211,7 @@ #define SSAIR_TURF_POST_PROCESS 10 #define SSAIR_FINALIZE_TURFS 11 #define SSAIR_ATMOSMACHINERY_AIR 12 +#define SSAIR_DEFERRED_AIRS 13 //! ## Overlays subsystem diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index e4d3d61c31..b844e9dbd9 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -9,6 +9,7 @@ SUBSYSTEM_DEF(air) var/cost_turfs = 0 var/cost_groups = 0 var/cost_highpressure = 0 + var/cost_deferred_airs var/cost_hotspots = 0 var/cost_post_process = 0 var/cost_superconductivity = 0 @@ -20,6 +21,7 @@ SUBSYSTEM_DEF(air) var/list/hotspots = list() var/list/networks = list() var/list/pipenets_needing_rebuilt = list() + var/list/deferred_airs = list() var/list/obj/machinery/atmos_machinery = list() var/list/obj/machinery/atmos_air_machinery = list() var/list/pipe_init_dirs_cache = list() @@ -83,6 +85,9 @@ SUBSYSTEM_DEF(air) /datum/controller/subsystem/air/proc/extools_update_ssair() //datum/controller/subsystem/air/proc/extools_update_reactions() +/datum/controller/subsystem/air/proc/thread_running() + return FALSE + /datum/controller/subsystem/air/fire(resumed = 0) var/timer = TICK_USAGE_REAL @@ -135,8 +140,15 @@ SUBSYSTEM_DEF(air) if(state != SS_RUNNING) return resumed = 0 + currentpart = SSAIR_DEFERRED_AIRS + if(currentpart == SSAIR_DEFERRED_AIRS) + timer = TICK_USAGE_REAL + process_deferred_airs(resumed) + cost_deferred_airs = MC_AVERAGE(cost_deferred_airs, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) + if(state != SS_RUNNING) + return + resumed = 0 currentpart = SSAIR_ATMOSMACHINERY_AIR - if(currentpart == SSAIR_ATMOSMACHINERY_AIR) timer = TICK_USAGE_REAL process_atmos_air_machinery(resumed) @@ -220,6 +232,19 @@ SUBSYSTEM_DEF(air) if(istype(atmos_machine, /obj/machinery/atmospherics)) pipenets_needing_rebuilt += atmos_machine +/datum/controller/subsystem/air/proc/process_deferred_airs(resumed = 0) + while(deferred_airs.len) + var/list/cur_op = deferred_airs[deferred_airs.len] + deferred_airs.len-- + var/turf/open/T = cur_op[1] + if(istype(cur_op[2],/datum/gas_mixture)) + T.air.merge(cur_op[2]) + else if(istype(cur_op[2], /datum/callback)) + var/datum/callback/cb = cur_op[2] + cb.Invoke(T) + if(MC_TICK_CHECK) + return + /datum/controller/subsystem/air/proc/process_atmos_machinery(resumed = 0) var/seconds = wait * 0.1 if (!resumed) diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm index 9e7bdae1b0..c87db4437d 100644 --- a/code/modules/atmospherics/environmental/LINDA_system.dm +++ b/code/modules/atmospherics/environmental/LINDA_system.dm @@ -131,5 +131,4 @@ var/datum/gas_mixture/G = new G.parse_gas_string(text) - - air.merge(G) + assume_air(G) diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm index de76193b99..e25a7ddd30 100644 --- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm +++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm @@ -48,8 +48,11 @@ /turf/open/assume_air(datum/gas_mixture/giver) //use this for machines to adjust air if(!giver) return FALSE - air.merge(giver) - update_visuals() + if(SSair.thread_running()) + SSair.deferred_airs += list(list(src, giver)) + else + air.merge(giver) + update_visuals() return TRUE /turf/open/remove_air(amount)