Merge pull request #10900 from Putnam3145/port-atmos-fix
Ports atmos priority reaction mix from TG
This commit is contained in:
@@ -337,8 +337,9 @@ GLOBAL_LIST_INIT(meta_gas_fusions, meta_gas_fusion_list())
|
||||
if(!length(cached_gases))
|
||||
return
|
||||
var/list/reactions = list()
|
||||
for(var/I in cached_gases)
|
||||
reactions += SSair.gas_reactions[I]
|
||||
for(var/datum/gas_reaction/G in SSair.gas_reactions)
|
||||
if(cached_gases[G.major_gas])
|
||||
reactions += G
|
||||
if(!length(reactions))
|
||||
return
|
||||
reaction_results = new
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
/proc/init_gas_reactions()
|
||||
. = list()
|
||||
for(var/type in subtypesof(/datum/gas))
|
||||
.[type] = list()
|
||||
|
||||
for(var/r in subtypesof(/datum/gas_reaction))
|
||||
var/datum/gas_reaction/reaction = r
|
||||
@@ -16,27 +14,19 @@
|
||||
var/datum/gas/req_gas = req
|
||||
if (!reaction_key || initial(reaction_key.rarity) > initial(req_gas.rarity))
|
||||
reaction_key = req_gas
|
||||
.[reaction_key] += list(reaction)
|
||||
sortTim(., /proc/cmp_gas_reactions, TRUE)
|
||||
reaction.major_gas = reaction_key
|
||||
. += reaction
|
||||
sortTim(., /proc/cmp_gas_reaction)
|
||||
|
||||
/proc/cmp_gas_reactions(list/datum/gas_reaction/a, list/datum/gas_reaction/b) // compares lists of reactions by the maximum priority contained within the list
|
||||
if (!length(a) || !length(b))
|
||||
return length(b) - length(a)
|
||||
var/maxa
|
||||
var/maxb
|
||||
for (var/datum/gas_reaction/R in a)
|
||||
if (R.priority > maxa)
|
||||
maxa = R.priority
|
||||
for (var/datum/gas_reaction/R in b)
|
||||
if (R.priority > maxb)
|
||||
maxb = R.priority
|
||||
return maxb - maxa
|
||||
/proc/cmp_gas_reaction(datum/gas_reaction/a, datum/gas_reaction/b) // compares lists of reactions by the maximum priority contained within the list
|
||||
return b.priority - a.priority
|
||||
|
||||
/datum/gas_reaction
|
||||
//regarding the requirements lists: the minimum or maximum requirements must be non-zero.
|
||||
//when in doubt, use MINIMUM_MOLE_COUNT.
|
||||
var/list/min_requirements
|
||||
var/list/max_requirements
|
||||
var/major_gas //the highest rarity gas used in the reaction.
|
||||
var/exclude = FALSE //do it this way to allow for addition/removal of reactions midmatch in the future
|
||||
var/priority = 100 //lower numbers are checked/react later than higher numbers. if two reactions have the same priority they may happen in either order
|
||||
var/name = "reaction"
|
||||
|
||||
Reference in New Issue
Block a user