maybe fixes reactions

This commit is contained in:
Katherine Kiefer
2022-03-01 11:20:27 +11:00
parent a9a69c4545
commit e9344a7164
3 changed files with 41 additions and 36 deletions

View File

@@ -35,6 +35,7 @@
)
)
fusion_power = 3
enthalpy = -393500
/datum/gas/plasma
id = GAS_PLASMA
@@ -43,7 +44,10 @@
gas_overlay = "plasma"
moles_visible = MOLES_GAS_VISIBLE
flags = GAS_FLAG_DANGEROUS
// no fire info cause it has its own bespoke reaction for trit generation reasons
fire_burn_rate = OXYGEN_BURN_RATE_BASE // named when plasma fires were the only fires, surely
fire_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
fire_products = "plasma_fire"
enthalpy = FIRE_PLASMA_ENERGY_RELEASED // 3000000, 3 megajoules, 3000 kj
/datum/gas/water_vapor
id = GAS_H2O
@@ -53,6 +57,7 @@
moles_visible = MOLES_GAS_VISIBLE
fusion_power = 8
breath_reagent = /datum/reagent/water
enthalpy = -241800 // FIRE_HYDROGEN_ENERGY_RELEASED is actually what this was supposed to be
/datum/gas/hypernoblium
id = GAS_HYPERNOB
@@ -71,6 +76,7 @@
fire_products = list(GAS_N2 = 1)
oxidation_rate = 0.5
oxidation_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST + 100
enthalpy = 81600
/datum/gas/nitryl
id = GAS_NITRYL
@@ -81,6 +87,7 @@
flags = GAS_FLAG_DANGEROUS
fusion_power = 15
fire_products = list(GAS_N2 = 0.5)
enthalpy = 33200
oxidation_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST - 50
/datum/gas/tritium
@@ -91,13 +98,11 @@
moles_visible = MOLES_GAS_VISIBLE
flags = GAS_FLAG_DANGEROUS
fusion_power = 1
/*
these are for when we add hydrogen, trit gets to keep its hardcoded fire for legacy reasons
fire_provides = list(GAS_H2O = 2)
fire_products = list(GAS_H2O = 1)
enthalpy = 40000
fire_burn_rate = 2
fire_energy_released = FIRE_HYDROGEN_ENERGY_RELEASED
fire_radiation_released = 50 // arbitrary number, basically 60 moles of trit burning will just barely start to harm you
fire_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST - 50
*/
/datum/gas/bz
id = GAS_BZ
@@ -105,6 +110,7 @@
name = "BZ"
flags = GAS_FLAG_DANGEROUS
fusion_power = 8
enthalpy = FIRE_CARBON_ENERGY_RELEASED // it is a mystery
/datum/gas/stimulum
id = GAS_STIMULUM
@@ -119,6 +125,7 @@
fusion_power = 10
oxidation_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 1000 // it is VERY stable
oxidation_rate = 8
enthalpy = -50000 // but it reduces the heat output a bit
/datum/gas/miasma
id = GAS_MIASMA
@@ -130,9 +137,13 @@
/datum/gas/hydrogen
id = GAS_H2
specific_heat = 15
specific_heat = 10
name = "Hydrogen"
flags = GAS_FLAG_DANGEROUS
fusion_power = 0
fire_products = list(GAS_H2O = 1)
fire_burn_rate = 2
fire_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST - 50
/datum/gas/freon
id = GAS_FREON

View File

@@ -32,11 +32,10 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
var/list/oxidation_temperatures = list()
var/list/oxidation_rates = list()
var/list/fire_temperatures = list()
var/list/fire_enthalpies = list()
var/list/enthalpies = list()
var/list/fire_products = list()
var/list/fire_burn_rates = list()
/datum/gas
var/id = ""
var/specific_heat = 0
@@ -53,9 +52,9 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
var/oxidation_rate = 1 // how many moles of this can oxidize how many moles of material
var/fire_temperature = null // temperature above which gas may catch fire; null for none
var/list/fire_products = null // what results when this gas is burned (oxidizer or fuel); null for none
var/fire_energy_released = 0 // how much energy is released per mole of fuel burned
var/enthalpy = 0 // Standard enthalpy of formation in joules, used for fires
var/fire_burn_rate = 1 // how many moles are burned per product released
var/rarity = 0
var/fire_radiation_released = 0 // How much radiation is released when this gas burns
/datum/gas/proc/breath(partial_pressure, light_threshold, heavy_threshold, moles, mob/living/carbon/C, obj/item/organ/lungs/lungs)
// This is only called on gases with the GAS_FLAG_BREATH_PROC flag. When possible, do NOT use this--
@@ -88,21 +87,18 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
breath_reagents[g] = gas.breath_reagent
if(gas.breath_reagent_dangerous)
breath_reagents_dangerous[g] = gas.breath_reagent_dangerous
if(gas.oxidation_temperature)
oxidation_temperatures[g] = gas.oxidation_temperature
oxidation_rates[g] = gas.oxidation_rate
if(gas.fire_products)
fire_products[g] = gas.fire_products
fire_enthalpies[g] = gas.fire_energy_released
enthalpies[g] = gas.enthalpy
else if(gas.fire_temperature)
fire_temperatures[g] = gas.fire_temperature
fire_burn_rates[g] = gas.fire_burn_rate
if(gas.fire_products)
fire_products[g] = gas.fire_products
fire_enthalpies[g] = gas.fire_energy_released
_auxtools_register_gas(gas)
enthalpies[g] = gas.enthalpy
/proc/finalize_gas_refs()

View File

@@ -35,20 +35,10 @@ nobliumformation = 1001
continue
reaction = new r
. += reaction
sortTim(., /proc/cmp_gas_reactions)
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.
@@ -85,20 +75,25 @@ nobliumformation = 1001
id = "vapor"
/datum/gas_reaction/water_vapor/init_reqs()
min_requirements = list(GAS_H2O = MOLES_GAS_VISIBLE)
min_requirements = list(
GAS_H2O = MOLES_GAS_VISIBLE,
"MAX_TEMP" = T0C + 40
)
/datum/gas_reaction/water_vapor/react(datum/gas_mixture/air, datum/holder)
var/turf/open/location = isturf(holder) ? holder : null
. = NO_REACTION
var/turf/open/location = holder
if(!istype(location))
return NO_REACTION
if (air.return_temperature() <= WATER_VAPOR_FREEZE)
if(location && location.freon_gas_act())
. = REACTING
return REACTING
else if(location && location.water_vapor_gas_act())
air.adjust_moles(GAS_H2O,-MOLES_GAS_VISIBLE)
. = REACTING
return REACTING
/datum/gas_reaction/nitrous_decomp
priority = 0
exclude = TRUE // generic fire now takes care of this
name = "Nitrous Oxide Decomposition"
id = "nitrous_decomp"
@@ -133,6 +128,7 @@ nobliumformation = 1001
//tritium combustion: combustion of oxygen and tritium (treated as hydrocarbons). creates hotspots. exothermic
/datum/gas_reaction/tritfire
priority = -1 //fire should ALWAYS be last, but tritium fires happen before plasma fires
exclude = TRUE // generic fire now takes care of this
name = "Tritium Combustion"
id = "tritfire"
@@ -222,6 +218,7 @@ nobliumformation = 1001
priority = -2 //fire should ALWAYS be last, but plasma fires happen after tritium fires
name = "Plasma Combustion"
id = "plasmafire"
exclude = TRUE // generic fire now takes care of this
/datum/gas_reaction/plasmafire/init_reqs()
min_requirements = list(
@@ -348,7 +345,7 @@ nobliumformation = 1001
fuels[fuel] *= oxidation_ratio
fuels += oxidizers
var/list/fire_products = GLOB.gas_data.fire_products
var/list/fire_enthalpies = GLOB.gas_data.fire_enthalpies
var/list/fire_enthalpies = GLOB.gas_data.enthalpies
for(var/fuel in fuels + oxidizers)
var/amt = fuels[fuel]
if(!burn_results[fuel])
@@ -707,6 +704,7 @@ nobliumformation = 1001
/datum/gas_reaction/h2fire
priority = -3 //fire should ALWAYS be last, but tritium fires happen before plasma fires
name = "Hydrogen Combustion"
exclude = TRUE // generic fire now takes care of this
id = "h2fire"
/datum/gas_reaction/h2fire/init_reqs()