This commit is contained in:
Putnam
2020-05-11 17:09:35 -07:00
parent e8d7da56f4
commit 121d594faa
5 changed files with 24 additions and 9 deletions
@@ -172,9 +172,12 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list())
/datum/gas_mixture/react(datum/holder)
. = NO_REACTION
if(!total_moles())
return
var/list/reactions = list()
for(var/I in get_gases())
reactions += SSair.gas_reactions[I]
for(var/datum/gas_reaction/G in SSair.gas_reactions)
if(get_moles(G.major_gas))
reactions += G
if(!length(reactions))
return
reaction_results = new
@@ -195,9 +198,22 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list())
continue
if(get_moles(id) < min_reqs[id])
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
if((max_reqs["TEMP"] && temp > max_reqs["TEMP"]) \
|| (max_reqs["ENER"] && ener > max_reqs["ENER"]))
continue
for(var/id in max_reqs)
if(id == "TEMP" || id == "ENER")
continue
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, holder)
if (. & STOP_REACTIONS)
break
@@ -15,8 +15,7 @@
..()
for(var/i in 1 to device_type)
var/datum/gas_mixture/A = new
A.set_volume(200)
var/datum/gas_mixture/A = new(200)
airs[i] = A
// Iconnery
@@ -18,8 +18,7 @@
..()
SSair.atmos_machinery += src
air_contents = new
air_contents.set_volume(volume)
air_contents = new(volume)
air_contents.set_temperature(T20C)
return 1