From 50bd078b433f0d08f963cca697cdc1dcd3ac03c5 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Mon, 18 Dec 2017 13:45:38 -0500 Subject: [PATCH] Merge pull request #33636 from duncathan/max_reqs restores reaction max_reqs checking code --- .../atmospherics/gasmixtures/gas_mixture.dm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm index 64d77a27dc..2ebf5bd7d5 100644 --- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm +++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm @@ -399,7 +399,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache()) return "" /datum/gas_mixture/react(turf/open/dump_location) - . = 0 + . = NO_REACTION reaction_results = new @@ -423,6 +423,22 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache()) continue reaction_loop //at this point, all minimum requirements for the reaction are satisfied. + /* currently no reactions have maximum requirements, so we can leave the checks commented out for a slight performance boost + PLEASE DO NOT REMOVE THIS CODE. the commenting is here only for a performance increase. + enabling these checks should be as easy as possible and the fact that they are disabled should be as clear as possible + + var/list/max_reqs = reaction.max_requirements.Copy() + if((max_reqs["TEMP"] && temp > max_reqs["TEMP"]) \ + || (max_reqs["ENER"] && ener > max_reqs["ENER"])) + continue + max_reqs -= "TEMP" + max_reqs -= "ENER" + for(var/id in max_reqs) + if(cached_gases[id] && cached_gases[id][MOLES] > max_reqs[id]) + continue reaction_loop + //at this point, all requirements for the reaction are satisfied. we can now react() + */ + . |= reaction.react(src, dump_location) if (. & STOP_REACTIONS) break