Added a zone-based optimization.

This commit is contained in:
Putnam
2021-02-02 17:35:10 -08:00
parent 9785b996ac
commit e1fbb27be5
7 changed files with 11 additions and 19 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+7 -2
View File
@@ -10,8 +10,13 @@
GLOBAL_LIST_EMPTY(auxtools_initialized) GLOBAL_LIST_EMPTY(auxtools_initialized)
#define AUXTOOLS_CHECK(LIB)\ #define AUXTOOLS_CHECK(LIB)\
if (!GLOB.auxtools_initialized[LIB] && fexists(LIB) && findtext(call(LIB,"auxtools_init")(),"SUCCESS"))\ if (!GLOB.auxtools_initialized[LIB] && fexists(LIB)) {\
GLOB.auxtools_initialized[LIB] = TRUE;\ var/status = call(LIB,"auxtools_init")();\
if(findtext(status,"SUCCESS")) {\
GLOB.auxtools_initialized[LIB] = TRUE;}\
else {\
auxtools_stack_trace("Auxtools failed with status [status]");};\
};
#define AUXTOOLS_SHUTDOWN(LIB)\ #define AUXTOOLS_SHUTDOWN(LIB)\
if (GLOB.auxtools_initialized[LIB] && fexists(LIB))\ if (GLOB.auxtools_initialized[LIB] && fexists(LIB))\
@@ -4,6 +4,7 @@ SUBSYSTEM_DEF(adjacent_air)
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
wait = 10 wait = 10
priority = FIRE_PRIORITY_ATMOS_ADJACENCY priority = FIRE_PRIORITY_ATMOS_ADJACENCY
init_order = INIT_ORDER_AIR_TURFS
var/list/queue = list() var/list/queue = list()
/datum/controller/subsystem/adjacent_air/stat_entry(msg) /datum/controller/subsystem/adjacent_air/stat_entry(msg)
@@ -17,8 +18,11 @@ SUBSYSTEM_DEF(adjacent_air)
/datum/controller/subsystem/adjacent_air/Initialize() /datum/controller/subsystem/adjacent_air/Initialize()
while(length(queue)) while(length(queue))
fire(mc_check = FALSE) fire(mc_check = FALSE)
build_zones()
return ..() return ..()
/datum/controller/subsystem/adjacent_air/proc/build_zones()
/datum/controller/subsystem/adjacent_air/fire(resumed = FALSE, mc_check = TRUE) /datum/controller/subsystem/adjacent_air/fire(resumed = FALSE, mc_check = TRUE)
var/list/queue = src.queue var/list/queue = src.queue
-14
View File
@@ -153,15 +153,6 @@ SUBSYSTEM_DEF(air)
if(state != SS_RUNNING) if(state != SS_RUNNING)
return return
resumed = 0 resumed = 0
currentpart = SSAIR_EXCITEDGROUPS
// Making small pressure deltas equalize immediately so they don't process anymore
if(currentpart == SSAIR_EXCITEDGROUPS)
timer = TICK_USAGE_REAL
process_excited_groups(resumed)
cost_groups = MC_AVERAGE(cost_groups, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
if(state != SS_RUNNING)
return
resumed = 0
currentpart = SSAIR_TURF_POST_PROCESS currentpart = SSAIR_TURF_POST_PROCESS
// Quick multithreaded "should we display/react?" checks followed by finishing those up before the next step // Quick multithreaded "should we display/react?" checks followed by finishing those up before the next step
if(currentpart == SSAIR_TURF_POST_PROCESS) if(currentpart == SSAIR_TURF_POST_PROCESS)
@@ -315,10 +306,6 @@ SUBSYSTEM_DEF(air)
return return
*/ */
/datum/controller/subsystem/air/proc/process_excited_groups(resumed = 0)
if(process_excited_groups_auxtools(resumed,MC_TICK_REMAINING_MS))
pause()
/datum/controller/subsystem/air/proc/finish_turf_processing(resumed = 0) /datum/controller/subsystem/air/proc/finish_turf_processing(resumed = 0)
if(finish_turf_processing_auxtools(MC_TICK_REMAINING_MS)) if(finish_turf_processing_auxtools(MC_TICK_REMAINING_MS))
pause() pause()
@@ -331,7 +318,6 @@ SUBSYSTEM_DEF(air)
/datum/controller/subsystem/air/proc/process_turfs_auxtools() /datum/controller/subsystem/air/proc/process_turfs_auxtools()
/datum/controller/subsystem/air/proc/post_process_turfs_auxtools() /datum/controller/subsystem/air/proc/post_process_turfs_auxtools()
/datum/controller/subsystem/air/proc/process_turf_equalize_auxtools() /datum/controller/subsystem/air/proc/process_turf_equalize_auxtools()
/datum/controller/subsystem/air/proc/process_excited_groups_auxtools()
/datum/controller/subsystem/air/proc/get_amt_gas_mixes() /datum/controller/subsystem/air/proc/get_amt_gas_mixes()
/datum/controller/subsystem/air/proc/get_max_gas_mixes() /datum/controller/subsystem/air/proc/get_max_gas_mixes()
/datum/controller/subsystem/air/proc/turf_process_time() /datum/controller/subsystem/air/proc/turf_process_time()
-1
View File
@@ -368,7 +368,6 @@
return FALSE return FALSE
/atom/proc/assume_air(datum/gas_mixture/giver) /atom/proc/assume_air(datum/gas_mixture/giver)
qdel(giver)
return null return null
/atom/proc/remove_air(amount) /atom/proc/remove_air(amount)
@@ -49,13 +49,11 @@
if(!giver) if(!giver)
return FALSE return FALSE
air.merge(giver) air.merge(giver)
update_visuals()
return TRUE return TRUE
/turf/open/remove_air(amount) /turf/open/remove_air(amount)
var/datum/gas_mixture/ours = return_air() var/datum/gas_mixture/ours = return_air()
var/datum/gas_mixture/removed = ours.remove(amount) var/datum/gas_mixture/removed = ours.remove(amount)
update_visuals()
return removed return removed
/turf/open/proc/copy_air_with_tile(turf/open/T) /turf/open/proc/copy_air_with_tile(turf/open/T)