From ff3818aa86bb90b97584260131b1112b5f3a294e Mon Sep 17 00:00:00 2001 From: Robustin Date: Tue, 27 Mar 2018 22:05:05 -0400 Subject: [PATCH] Gas react is much more efficient (#36667) * React but with some conditions first * Update gas_types.dm * Webeditor maymay * This might break fire but isn't that what freezes are for? * More webeditor memes * Did that madman just make it even FASTER? * Changing list to typecache * Gotta go faster * review, dnm yet * gas.len instead of volume * Dunc the redeemed * Merge ready * Dunc's method actually wasnt the best --- .../atmospherics/gasmixtures/gas_mixture.dm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm index 007aad331a..60dba541f3 100644 --- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm +++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm @@ -8,6 +8,7 @@ What are the archived variables for? once gases got hot enough, most procedures wouldnt occur due to the fact that the mole counts would get rounded away. Thus, we lowered it a few orders of magnititude */ GLOBAL_LIST_INIT(meta_gas_info, meta_gas_list()) //see ATMOSPHERICS/gas_types.dm GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache()) +GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/gas/nitrogen, /datum/gas/carbon_dioxide))) // These gasses cannot react amongst themselves /proc/init_gaslist_cache() . = list() @@ -411,10 +412,18 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache()) /datum/gas_mixture/react(turf/open/dump_location) . = NO_REACTION - - reaction_results = new - var/list/cached_gases = gases + if(!cached_gases.len) + return + var/possible + for(var/I in cached_gases) + if(GLOB.nonreactive_gases[I]) + continue + possible = TRUE + break + if(!possible) + return + reaction_results = new var/temp = temperature var/ener = THERMAL_ENERGY(src)