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
This commit is contained in:
Robustin
2018-03-27 22:05:05 -04:00
committed by CitadelStationBot
parent 77f40b6be9
commit ff3818aa86

View File

@@ -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)