Finished the first auxgm expansion

This commit is contained in:
Putnam
2021-06-11 16:15:00 -07:00
parent eda6a4d2e2
commit 571a25c052
11 changed files with 146 additions and 97 deletions
@@ -16,12 +16,12 @@
/datum/breathing_class/oxygen
gases = list(
GAS_O2 = 1
GAS_O2 = 1,
GAS_PLUOXIUM = 8,
GAS_CO2 = -0.7, // CO2 isn't actually toxic, just an asphyxiant
)
products = list(
GAS_CO2 = 1
GAS_CO2 = 1,
)
/datum/breathing_class/plasma
+6 -7
View File
@@ -11,7 +11,7 @@
not_enough_alert = list(
alert_category = "not_enough_nitro",
alert_type = /obj/screen/alert/not_enough_nitro
)
),
too_much_alert = list(
alert_category = "too_much_nitro",
alert_type = /obj/screen/alert/too_much_nitro
@@ -28,13 +28,12 @@
not_enough_alert = list(
alert_category = "not_enough_co2",
alert_type = /obj/screen/alert/not_enough_co2
)
),
too_much_alert = list(
alert_category = "too_much_co2",
alert_type = /obj/screen/alert/too_much_co2
)
)
breath_reagent_dangerous = /datum/reagent/co2_toxic
fusion_power = 3
/datum/gas/plasma
@@ -134,13 +133,13 @@
specific_heat = 30
name = "Methane"
breath_results = GAS_METHYL_BROMIDE
fire_provides = list(GAS_CO2 = 1, GAS_H2O = 2)
fire_products = list(GAS_CO2 = 1, GAS_H2O = 2)
fire_burn_rate = 0.5
breath_alert_info = list(
not_enough_alert = list(
alert_category = "not_enough_ch4",
alert_type = /obj/screen/alert/not_enough_ch4
)
),
too_much_alert = list(
alert_category = "too_much_ch4",
alert_type = /obj/screen/alert/too_much_ch4
@@ -158,13 +157,13 @@
not_enough_alert = list(
alert_category = "not_enough_ch3br",
alert_type = /obj/screen/alert/not_enough_ch3br
)
),
too_much_alert = list(
alert_category = "too_much_ch3br",
alert_type = /obj/screen/alert/too_much_ch3br
)
)
fire_provides = list(GAS_CO2 = 1, GAS_H2O = 1.5, GAS_BZ = 0.5)
fire_products = list(GAS_CO2 = 1, GAS_H2O = 1.5, GAS_BZ = 0.5)
fire_energy_released = FIRE_CARBON_ENERGY_RELEASED
fire_burn_rate = 0.5
fire_temperature = 808 // its autoignition, it apparently doesn't spark readily, so i don't put it lower
@@ -61,7 +61,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
// greatly prefer just adding a reagent. This is mostly around for legacy reasons.
return null
/datum/auxgm/add_gas(datum/gas/gas)
/datum/auxgm/proc/add_gas(datum/gas/gas)
var/g = gas.id
if(g)
datums[g] = gas
@@ -77,7 +77,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
overlays[g] = 0
flags[g] = gas.flags
ids[g] = g
typepaths[g] = gas_path
typepaths[g] = gas.type
fusion_powers[g] = gas.fusion_power
if(gas.breath_alert_info)
@@ -103,10 +103,17 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
_auxtools_register_gas(gas)
/proc/finalize_gas_refs()
/datum/auxgm/New()
for(var/gas_path in subtypesof(/datum/gas))
var/datum/gas/gas = new gas_path
add_gas(gas)
for(var/breathing_class_path in subtypesof(/datum/breathing_class))
var/datum/breathing_class/class = new breathing_class_path
breathing_classes[breathing_class_path] = class
finalize_gas_refs()
GLOBAL_DATUM_INIT(gas_data, /datum/auxgm, new)
@@ -246,19 +246,34 @@
name = "Combustion"
id = "genericfire"
/datum/gas_reaction/genericfire/init_reqs()
var/lowest_fire_temp = INFINITY
var/list/fire_temperatures = GLOB.gas_data.fire_temperatures
for(var/gas in fire_temperatures)
lowest_fire_temp = min(lowest_fire_temp, fire_temperatures[gas])
var/lowest_oxi_temp = INFINITY
var/list/oxidation_temperatures = GLOB.gas_data.oxidation_temperatures
for(var/gas in oxidation_temperatures)
lowest_oxi_temp = min(lowest_oxi_temp, oxidation_temperatures[gas])
min_requirements = list(
"TEMP" = max(lowest_oxi_temp, lowest_fire_temp),
"FIRE_REAGENTS" = MINIMUM_MOLE_COUNT
)
// no requirements, always runs
// bad idea? maybe
// this is overridden by auxmos but, hey, good idea to have it readable
/datum/gas_reaction/genericfire/react(datum/gas_mixture/air, datum/holder)
var/temperature = air.return_temperature()
var/list/oxidation_temps = GLOB.gas_data.oxidation_temps
var/list/oxidation_temps = GLOB.gas_data.oxidation_temperatures
var/list/oxidation_rates = GLOB.gas_data.oxidation_rates
var/oxidation_power = 0
var/list/burn_results = list()
var/list/fuels = list()
var/list/oxidizers = list()
var/list/fuel_rates = GLOB.gas_data.fuel_rates
var/list/fuel_rates = GLOB.gas_data.fire_burn_rates
var/list/fuel_temps = GLOB.gas_data.fire_temperatures
var/total_fuel = 0
var/energy_released = 0
for(var/G in air.get_gases())
@@ -280,7 +295,7 @@
if(oxidation_ratio > 1)
for(var/oxidizer in oxidizers)
oxidizers[oxidizer] /= oxidation_ratio
else if oxidation_ratio < 1
else if(oxidation_ratio < 1)
for(var/fuel in fuels)
fuels[fuel] *= oxidation_ratio
fuels += oxidizers
@@ -295,7 +310,7 @@
for(var/product in fire_products[fuel])
if(!burn_results[product])
burn_results[product] = 0
burn_results[o] += amt
burn_results[product] += amt
var/final_energy = air.thermal_energy() + energy_released
for(var/result in burn_results)
air.adjust_moles(result, burn_results[result])
@@ -94,7 +94,7 @@
var/list/TLV = list( // Breathable air.
"pressure" = new/datum/tlv(ONE_ATMOSPHERE * 0.8, ONE_ATMOSPHERE* 0.9, ONE_ATMOSPHERE * 1.1, ONE_ATMOSPHERE * 1.2), // kPa
"temperature" = new/datum/tlv(T0C, T0C+10, T0C+40, T0C+66),
GAS_O2 = new/datum/tlv(16, 19, 135, 140), // Partial pressure, kpa
GAS_O2 = new/datum/tlv(16, 19, 40, 50), // Partial pressure, kpa
GAS_N2 = new/datum/tlv(-1, -1, 1000, 1000),
GAS_CO2 = new/datum/tlv(-1, -1, 5, 10),
GAS_MIASMA = new/datum/tlv(-1, -1, 2, 5),
@@ -106,7 +106,7 @@
GAS_TRITIUM = new/datum/tlv/dangerous,
GAS_STIMULUM = new/datum/tlv(-1, -1, 1000, 1000), // Stimulum has only positive effects
GAS_NITRYL = new/datum/tlv/dangerous,
GAS_PLUOXIUM = new/datum/tlv(-1, -1, 1000, 1000), // Unlike oxygen, pluoxium does not fuel plasma/tritium fires
GAS_PLUOXIUM = new/datum/tlv(-1, -1, 5, 6), // Unlike oxygen, pluoxium does not fuel plasma/tritium fires
GAS_METHANE = new/datum/tlv(-1, -1, 3, 6),
GAS_METHYL_BROMIDE = new/datum/tlv/dangerous
)