fix reaction orderings

This commit is contained in:
Katherine Kiefer
2022-08-01 20:08:45 +10:00
parent 1bc0385faf
commit 02706f6477
3 changed files with 87 additions and 58 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -1,30 +1,35 @@
//All defines used in reactions are located in ..\__DEFINES\reactions.dm //All defines used in reactions are located in ..\__DEFINES\reactions.dm
/*priority so far, check this list to see what are the numbers used. Please use a different priority for each reaction(higher number are done first) //priority so far, check this list to see what are the numbers used.
miaster = -10 (this should always be under all other fires) //Please use a different priority for each reaction(higher number are done first)
freonfire = -5 //or else auxmos will ignore the reaction
plasmafire = -4 //NOTE: ONLY INTEGERS ARE ALLOWED, EXPECT WEIRDNESS IF YOU DON'T FOLLOW THIS
h2fire = -3 #define MIASTER -10
tritfire = -2 #define FREONFIRE -5
halon_o2removal = -1 #define PLASMAFIRE -4
nitrous_decomp = 0 #define H2FIRE -3
water_vapor = 1 #define TRITFIRE -2
fusion = 2 #define HALONO2REMOVAL -1
nitrylformation = 3 #define NITROUSDECOMP 0
bzformation = 4 #define WATERVAPOR 1
freonformation = 5 #define FUSION 2
stimformation = 6 #define COLDFUSION 3
stim_ball = 7 #define NITRYLFORMATION 4
zauker_decomp = 8 #define BZFORMATION 5
healium_formation = 9 #define FREONFORMATION 6
pluonium_formation = 10 #define STIMFORMATION 7
zauker_formation = 11 #define STIMBALL 8
halon_formation = 12 #define ZAUKERDECOMP 9
hexane_formation = 13 #define HEALIUMFORMATION 10
pluonium_response = 14 - 16 #define PLUONIUMFORMATION 11
metalhydrogen = 17 #define ZAUKERFORMATION 12
nobliumsuppression = 1000 #define HALONFORMATION 13
nobliumformation = 1001 #define HEXANEFORMATION 14
*/ #define PLUONIUMBZRESPONSE 15
#define PLUONIUMTRITRESPONSE 16
#define PLUONIUMH2RESPONSE 17
#define METALHYDROGEN 18
#define NOBLIUMSUPPRESSION 1000
#define NOBLIUMFORMATION 1001
/proc/init_gas_reactions() /proc/init_gas_reactions()
. = list() . = list()
@@ -35,17 +40,13 @@ nobliumformation = 1001
continue continue
reaction = new r reaction = new r
. += reaction . += reaction
sortTim(., /proc/cmp_gas_reaction)
/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 /datum/gas_reaction
//regarding the requirements lists: the minimum or maximum requirements must be non-zero. //regarding the requirements lists: the minimum or maximum requirements must be non-zero.
//when in doubt, use MINIMUM_MOLE_COUNT. //when in doubt, use MINIMUM_MOLE_COUNT.
var/list/min_requirements var/list/min_requirements
var/exclude = FALSE //do it this way to allow for addition/removal of reactions midmatch in the future 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/priority = -1000 //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" var/name = "reaction"
var/id = "r" var/id = "r"
@@ -68,7 +69,7 @@ nobliumformation = 1001
return location return location
/datum/gas_reaction/nobliumsupression /datum/gas_reaction/nobliumsupression
priority = 1000 //ensure all non-HN reactions are lower than this number. priority = NOBLIUMSUPPRESSION //ensure all non-HN reactions are lower than this number.
name = "Hyper-Noblium Reaction Suppression" name = "Hyper-Noblium Reaction Suppression"
id = "nobstop" id = "nobstop"
@@ -80,7 +81,7 @@ nobliumformation = 1001
//water vapor: puts out fires? //water vapor: puts out fires?
/datum/gas_reaction/water_vapor /datum/gas_reaction/water_vapor
priority = 1 priority = WATERVAPOR
name = "Water Vapor" name = "Water Vapor"
id = "vapor" id = "vapor"
@@ -101,7 +102,7 @@ nobliumformation = 1001
//tritium combustion: combustion of oxygen and tritium (treated as hydrocarbons). creates hotspots. exothermic //tritium combustion: combustion of oxygen and tritium (treated as hydrocarbons). creates hotspots. exothermic
/datum/gas_reaction/tritfire /datum/gas_reaction/tritfire
priority = -2 //fire should ALWAYS be last, but tritium fires happen before plasma fires priority = TRITFIRE //fire should ALWAYS be last, but tritium fires happen before plasma fires
name = "Tritium Combustion" name = "Tritium Combustion"
id = "tritfire" id = "tritfire"
@@ -159,7 +160,7 @@ nobliumformation = 1001
//plasma combustion: combustion of oxygen and plasma (treated as hydrocarbons). creates hotspots. exothermic //plasma combustion: combustion of oxygen and plasma (treated as hydrocarbons). creates hotspots. exothermic
/datum/gas_reaction/plasmafire /datum/gas_reaction/plasmafire
priority = -4 //fire should ALWAYS be last, but plasma fires happen after tritium fires priority = PLASMAFIRE //fire should ALWAYS be last, but plasma fires happen after tritium fires
name = "Plasma Combustion" name = "Plasma Combustion"
id = "plasmafire" id = "plasmafire"
@@ -233,7 +234,7 @@ nobliumformation = 1001
return cached_results["fire"] ? REACTING : NO_REACTION return cached_results["fire"] ? REACTING : NO_REACTION
/datum/gas_reaction/n2odecomp /datum/gas_reaction/n2odecomp
priority = 0 priority = NITROUSDECOMP
name = "Nitrous Oxide Decomposition" name = "Nitrous Oxide Decomposition"
id = "n2odecomp" id = "n2odecomp"
@@ -266,7 +267,7 @@ nobliumformation = 1001
/datum/gas_reaction/cold_fusion /datum/gas_reaction/cold_fusion
exclude = FALSE exclude = FALSE
priority = 2 priority = COLDFUSION
name = "Cold Plasmic Fusion" name = "Cold Plasmic Fusion"
id = "coldfusion" id = "coldfusion"
@@ -287,7 +288,7 @@ nobliumformation = 1001
/datum/gas_reaction/fusion /datum/gas_reaction/fusion
exclude = FALSE exclude = FALSE
priority = 2 priority = FUSION
name = "Plasmic Fusion" name = "Plasmic Fusion"
id = "fusion" id = "fusion"
@@ -365,7 +366,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/nitrylformation //The formation of nitryl. Endothermic. Requires N2O as a catalyst. /datum/gas_reaction/nitrylformation //The formation of nitryl. Endothermic. Requires N2O as a catalyst.
priority = 3 priority = NITRYLFORMATION
name = "Nitryl formation" name = "Nitryl formation"
id = "nitrylformation" id = "nitrylformation"
@@ -399,7 +400,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/bzformation //Formation of BZ by combining plasma and tritium at low pressures. Exothermic. /datum/gas_reaction/bzformation //Formation of BZ by combining plasma and tritium at low pressures. Exothermic.
priority = 4 priority = BZFORMATION
name = "BZ Gas formation" name = "BZ Gas formation"
id = "bzformation" id = "bzformation"
@@ -437,7 +438,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/stimformation //Stimulum formation follows a strange pattern of how effective it will be at a given temperature, having some multiple peaks and some large dropoffs. Exo and endo thermic. /datum/gas_reaction/stimformation //Stimulum formation follows a strange pattern of how effective it will be at a given temperature, having some multiple peaks and some large dropoffs. Exo and endo thermic.
priority = 6 priority = STIMFORMATION
name = "Stimulum formation" name = "Stimulum formation"
id = "stimformation" id = "stimformation"
@@ -469,7 +470,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/nobliumformation //Hyper-Noblium formation is extrememly endothermic, but requires high temperatures to start. Due to its high mass, hyper-nobelium uses large amounts of nitrogen and tritium. BZ can be used as a catalyst to make it less endothermic. /datum/gas_reaction/nobliumformation //Hyper-Noblium formation is extrememly endothermic, but requires high temperatures to start. Due to its high mass, hyper-nobelium uses large amounts of nitrogen and tritium. BZ can be used as a catalyst to make it less endothermic.
priority = 1001 //Ensure this value is higher than nobstop priority = NOBLIUMFORMATION //Ensure this value is higher than nobstop
name = "Hyper-Noblium condensation" name = "Hyper-Noblium condensation"
id = "nobformation" id = "nobformation"
@@ -499,7 +500,7 @@ nobliumformation = 1001
/datum/gas_reaction/miaster //dry heat sterilization: clears out pathogens in the air /datum/gas_reaction/miaster //dry heat sterilization: clears out pathogens in the air
priority = -10 //after all the heating from fires etc. is done priority = MIASTER //after all the heating from fires etc. is done
name = "Dry Heat Sterilization" name = "Dry Heat Sterilization"
id = "sterilization" id = "sterilization"
@@ -525,7 +526,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/stim_ball /datum/gas_reaction/stim_ball
priority = 7 priority = STIMBALL
name ="Stimulum Energy Ball" name ="Stimulum Energy Ball"
id = "stimball" id = "stimball"
@@ -569,7 +570,7 @@ nobliumformation = 1001
//freon reaction (is not a fire yet) //freon reaction (is not a fire yet)
/datum/gas_reaction/freonfire /datum/gas_reaction/freonfire
priority = -5 priority = FREONFIRE
name = "Freon combustion" name = "Freon combustion"
id = "freonfire" id = "freonfire"
@@ -625,7 +626,7 @@ nobliumformation = 1001
air.set_temperature((old_thermal_energy + energy_released) / new_heat_capacity) air.set_temperature((old_thermal_energy + energy_released) / new_heat_capacity)
/datum/gas_reaction/h2fire /datum/gas_reaction/h2fire
priority = -3 //fire should ALWAYS be last, but tritium fires happen before plasma fires priority = H2FIRE //fire should ALWAYS be last, but tritium fires happen before plasma fires
name = "Hydrogen Combustion" name = "Hydrogen Combustion"
id = "h2fire" id = "h2fire"
@@ -680,7 +681,7 @@ nobliumformation = 1001
/datum/gas_reaction/hexane_formation /datum/gas_reaction/hexane_formation
priority = 13 priority = HEXANEFORMATION
name = "Hexane formation" name = "Hexane formation"
id = "hexane_formation" id = "hexane_formation"
@@ -712,7 +713,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/metalhydrogen /datum/gas_reaction/metalhydrogen
priority = 17 priority = METALHYDROGEN
name = "Metal Hydrogen formation" name = "Metal Hydrogen formation"
id = "metalhydrogen" id = "metalhydrogen"
@@ -751,7 +752,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/freonformation /datum/gas_reaction/freonformation
priority = 5 priority = FREONFORMATION
name = "Freon formation" name = "Freon formation"
id = "freonformation" id = "freonformation"
@@ -785,7 +786,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/halon_formation /datum/gas_reaction/halon_formation
priority = 12 priority = HALONFORMATION
name = "Halon formation" name = "Halon formation"
id = "halon_formation" id = "halon_formation"
@@ -817,7 +818,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/healium_formation /datum/gas_reaction/healium_formation
priority = 9 priority = HEALIUMFORMATION
name = "Healium formation" name = "Healium formation"
id = "healium_formation" id = "healium_formation"
@@ -849,7 +850,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/pluonium_formation /datum/gas_reaction/pluonium_formation
priority = 10 priority = PLUONIUMFORMATION
name = "Pluonium formation" name = "Pluonium formation"
id = "pluonium_formation" id = "pluonium_formation"
@@ -881,7 +882,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/zauker_formation /datum/gas_reaction/zauker_formation
priority = 11 priority = ZAUKERFORMATION
name = "Zauker formation" name = "Zauker formation"
id = "zauker_formation" id = "zauker_formation"
@@ -913,7 +914,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/halon_o2removal /datum/gas_reaction/halon_o2removal
priority = -1 priority = HALONO2REMOVAL
name = "Halon o2 removal" name = "Halon o2 removal"
id = "halon_o2removal" id = "halon_o2removal"
@@ -944,7 +945,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/zauker_decomp /datum/gas_reaction/zauker_decomp
priority = 8 priority = ZAUKERDECOMP
name = "Zauker decomposition" name = "Zauker decomposition"
id = "zauker_decomp" id = "zauker_decomp"
@@ -975,7 +976,7 @@ nobliumformation = 1001
return NO_REACTION return NO_REACTION
/datum/gas_reaction/pluonium_bz_response /datum/gas_reaction/pluonium_bz_response
priority = 14 priority = PLUONIUMBZRESPONSE
name = "Pluonium bz response" name = "Pluonium bz response"
id = "pluonium_bz_response" id = "pluonium_bz_response"
@@ -1012,7 +1013,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/pluonium_tritium_response /datum/gas_reaction/pluonium_tritium_response
priority = 15 priority = PLUONIUMTRITRESPONSE
name = "Pluonium tritium response" name = "Pluonium tritium response"
id = "pluonium_tritium_response" id = "pluonium_tritium_response"
@@ -1047,7 +1048,7 @@ nobliumformation = 1001
return REACTING return REACTING
/datum/gas_reaction/pluonium_hydrogen_response /datum/gas_reaction/pluonium_hydrogen_response
priority = 16 priority = PLUONIUMH2RESPONSE
name = "Pluonium hydrogen response" name = "Pluonium hydrogen response"
id = "pluonium_hydrogen_response" id = "pluonium_hydrogen_response"
@@ -1073,3 +1074,31 @@ nobliumformation = 1001
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
air.set_temperature(max((old_thermal_energy - energy_released) / new_heat_capacity, TCMB)) air.set_temperature(max((old_thermal_energy - energy_released) / new_heat_capacity, TCMB))
return REACTING return REACTING
#undef MIASTER
#undef FREONFIRE
#undef PLASMAFIRE
#undef H2FIRE
#undef TRITFIRE
#undef HALONO2REMOVAL
#undef NITROUSDECOMP
#undef WATERVAPOR
#undef FUSION
#undef COLDFUSION
#undef NITRYLFORMATION
#undef BZFORMATION
#undef FREONFORMATION
#undef STIMFORMATION
#undef STIMBALL
#undef ZAUKERDECOMP
#undef HEALIUMFORMATION
#undef PLUONIUMFORMATION
#undef ZAUKERFORMATION
#undef HALONFORMATION
#undef HEXANEFORMATION
#undef PLUONIUMBZRESPONSE
#undef PLUONIUMTRITRESPONSE
#undef PLUONIUMH2RESPONSE
#undef METALHYDROGEN
#undef NOBLIUMSUPPRESSION
#undef NOBLIUMFORMATION