Fire overhaul

This commit is contained in:
Putnam3145
2021-11-13 22:43:54 -08:00
parent 007d347d82
commit 60e61ecbb0
10 changed files with 81 additions and 28 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -264,9 +264,13 @@
#define GAS_MIASMA "miasma"
#define GAS_METHANE "methane"
#define GAS_METHYL_BROMIDE "methyl_bromide"
#define GAS_BROMINE "bromine"
#define GAS_GROUP_CHEMICALS "Chemicals"
#define GAS_FLAG_DANGEROUS (1<<0)
#define GAS_FLAG_BREATH_PROC (1<<1)
#define GAS_FLAG_CHEMICAL (1<<2)
//SUPERMATTER DEFINES
#define HEAT_PENALTY "heat penalties"

View File

@@ -13,7 +13,7 @@
#define NITRYL_FORMATION_ENERGY 100000
#define TRITIUM_BURN_OXY_FACTOR 100
#define TRITIUM_BURN_TRIT_FACTOR 10
#define TRITIUM_BURN_RADIOACTIVITY_FACTOR 50000 //The neutrons gotta go somewhere. Completely arbitrary number.
#define TRITIUM_BURN_RADIOACTIVITY_FACTOR 5000 //The neutrons gotta go somewhere. Completely arbitrary number.
#define TRITIUM_MINIMUM_RADIATION_ENERGY 0.1 //minimum 0.01 moles trit or 10 moles oxygen to start producing rads
#define SUPER_SATURATION_THRESHOLD 96
#define STIMULUM_HEAT_SCALE 100000

View File

@@ -43,6 +43,7 @@
)
)
fusion_power = 3
enthalpy = -393500
/datum/gas/plasma
id = GAS_PLASMA
@@ -54,7 +55,10 @@
heat_penalty = 15
transmit_modifier = 4
powermix = 1
// 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
@@ -64,6 +68,7 @@
moles_visible = MOLES_GAS_VISIBLE
fusion_power = 8
heat_penalty = 8
enthalpy = -241800 // FIRE_HYDROGEN_ENERGY_RELEASED is actually what this was supposed to be
powermix = 1
breath_reagent = /datum/reagent/water
@@ -84,6 +89,7 @@
fire_products = list(GAS_N2 = 1)
oxidation_rate = 0.5
oxidation_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST + 100
enthalpy = 81600
heat_resistance = 6
/datum/gas/nitryl
@@ -95,6 +101,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
@@ -108,13 +115,10 @@
powermix = 1
heat_penalty = 10
transmit_modifier = 30
/*
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 = 2)
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
@@ -124,6 +128,7 @@
fusion_power = 8
powermix = 1
heat_penalty = 5
enthalpy = FIRE_CARBON_ENERGY_RELEASED // it is a mystery
transmit_modifier = -2
radioactivity_modifier = 5
@@ -139,7 +144,8 @@
name = "Pluoxium"
fusion_power = 10
oxidation_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 1000 // it is VERY stable
oxidation_rate = 8
oxidation_rate = 8 // when it can oxidize, it can oxidize a LOT
enthalpy = -50000 // but it reduces the heat output a bit
powermix = -1
heat_penalty = -1
transmit_modifier = -5
@@ -172,7 +178,7 @@
alert_type = /atom/movable/screen/alert/too_much_ch4
)
)
fire_energy_released = FIRE_CARBON_ENERGY_RELEASED
enthalpy = -74600
fire_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
/datum/gas/methyl_bromide
@@ -192,7 +198,16 @@
alert_type = /atom/movable/screen/alert/too_much_ch3br
)
)
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_products = list(GAS_CO2 = 1, GAS_H2O = 1.5, GAS_BROMINE = 0.5)
enthalpy = -35400
fire_burn_rate = 4 / 7 // oh no
fire_temperature = 808 // its autoignition, it apparently doesn't spark readily, so i don't put it lower
/datum/gas/bromine
id = GAS_BROMINE
specific_heat = 76
name = "Bromine"
flags = GAS_FLAG_DANGEROUS
group = GAS_GROUP_CHEMICALS
enthalpy = 193 // yeah it's small but it's good to include it
breath_reagent = /datum/reagent/bromine

View File

@@ -32,10 +32,12 @@ 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()
var/list/supermatter = list()
var/list/groups_by_gas = list()
var/list/groups = list()
/datum/gas
@@ -45,6 +47,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
var/gas_overlay = "" //icon_state in icons/effects/atmospherics.dmi
var/moles_visible = null
var/flags = NONE //currently used by canisters
var/group = null // groups for scrubber/filter listing
var/fusion_power = 0 // How much the gas destabilizes a fusion reaction
var/breath_results = GAS_CO2 // what breathing this breathes out
var/breath_reagent = null // what breathing this adds to your reagents
@@ -54,8 +57,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/fire_radiation_released = 0 // How much radiation is released when this gas burns
var/powermix = 0 // how much this gas contributes to the supermatter's powermix ratio
var/heat_penalty = 0 // heat and waste penalty from having the supermatter crystal surrounded by this gas; negative numbers reduce
var/transmit_modifier = 0 // bonus to supermatter power generation (multiplicative, since it's % based, and divided by 10)
@@ -100,13 +104,18 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GA
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
enthalpies[g] = gas.enthalpy
if(gas.group)
if(!(gas.group in groups))
groups[gas.group] = list()
groups[gas.group] += gas
groups_by_gas[g] = gas.group
add_supermatter_properties(gas)
_auxtools_register_gas(gas)

View File

@@ -53,7 +53,10 @@
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
@@ -70,6 +73,7 @@
//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"
@@ -88,9 +92,9 @@
item.temperature_expose(air, temperature, CELL_VOLUME)
location.temperature_expose(air, temperature, CELL_VOLUME)
/proc/radiation_burn(turf/open/location, energy_released)
/proc/radiation_burn(turf/open/location, rad_power)
if(istype(location) && prob(10))
radiation_pulse(location, energy_released/TRITIUM_BURN_RADIOACTIVITY_FACTOR)
radiation_pulse(location, rad_power)
/datum/gas_reaction/tritfire/react(datum/gas_mixture/air, datum/holder)
var/energy_released = 0
@@ -151,6 +155,7 @@
/datum/gas_reaction/plasmafire
priority = -2 //fire should ALWAYS be last, but plasma fires happen after tritium fires
name = "Plasma Combustion"
exclude = TRUE // generic fire now takes care of this
id = "plasmafire"
/datum/gas_reaction/plasmafire/init_reqs()
@@ -300,7 +305,7 @@
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])

View File

@@ -100,7 +100,10 @@
if(transfer_ratio > 0)
if(filter_type && air2.return_pressure() <= 9000)
air1.scrub_into(air2, transfer_ratio, list(filter_type))
if(filter_type in GLOB.gas_data.groups)
air1.scrub_into(air2, transfer_ratio, GLOB.gas_data.groups[filter_type])
else
air1.scrub_into(air2, transfer_ratio, list(filter_type))
if(air3.return_pressure() <= 9000)
air1.transfer_ratio_to(air3, transfer_ratio)
@@ -125,8 +128,10 @@
data["filter_types"] = list()
data["filter_types"] += list(list("name" = "Nothing", "id" = "", "selected" = !filter_type))
for(var/id in GLOB.gas_data.ids)
data["filter_types"] += list(list("name" = GLOB.gas_data.names[id], "id" = id, "selected" = (id == filter_type)))
if(!(id in GLOB.gas_data.groups_by_gas))
data["filter_types"] += list(list("name" = GLOB.gas_data.names[id], "id" = id, "selected" = (id == filter_type)))
for(var/group in GLOB.gas_data.groups)
data["filter_types"] += list(list("name" = group, "id" = group, "selected" = (group == filter_type)))
return data
/obj/machinery/atmospherics/components/trinary/filter/ui_act(action, params)

View File

@@ -18,7 +18,8 @@
var/id_tag = null
var/scrubbing = SCRUBBING //0 = siphoning, 1 = scrubbing
var/filter_types = list(GAS_CO2)
var/filter_types = list(GAS_CO2, GAS_MIASMA, GAS_GROUP_CHEMICALS)
var/list/clean_filter_types = null
var/volume_rate = 200
var/widenet = 0 //is this scrubber acting on the 3x3 area around it.
var/list/turf/adjacent_turfs = list()
@@ -34,6 +35,15 @@
..()
if(!id_tag)
id_tag = assign_uid_vents()
generate_clean_filter_types()
/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/generate_clean_filter_types()
clean_filter_types = list()
for(var/id in filter_types)
if(id in GLOB.gas_data.groups)
clean_filter_types += GLOB.gas_data.groups[id]
else
clean_filter_types += id
/obj/machinery/atmospherics/components/unary/vent_scrubber/Destroy()
var/area/A = get_base_area(src)
@@ -95,7 +105,11 @@
var/list/f_types = list()
for(var/id in GLOB.gas_data.ids)
f_types += list(list("gas_id" = id, "gas_name" = GLOB.gas_data.names[id], "enabled" = (id in filter_types)))
if(!(id in GLOB.gas_data.groups_by_gas))
f_types += list(list("gas_id" = id, "gas_name" = GLOB.gas_data.names[id], "enabled" = (id in filter_types)))
for(var/group in GLOB.gas_data.groups)
f_types += list(list("gas_id" = group, "gas_name" = group, "enabled" = (group in filter_types)))
var/datum/signal/signal = new(list(
"tag" = id_tag,
@@ -147,11 +161,11 @@
var/datum/gas_mixture/environment = tile.return_air()
var/datum/gas_mixture/air_contents = airs[1]
if(air_contents.return_pressure() >= 50*ONE_ATMOSPHERE || !islist(filter_types))
if(air_contents.return_pressure() >= 50*ONE_ATMOSPHERE || !islist(clean_filter_types))
return FALSE
if(scrubbing & SCRUBBING)
environment.scrub_into(air_contents, volume_rate/environment.return_volume(), filter_types)
environment.scrub_into(air_contents, volume_rate/environment.return_volume(), clean_filter_types)
tile.air_update_turf()
@@ -205,11 +219,13 @@
if("toggle_filter" in signal.data)
filter_types ^= signal.data["toggle_filter"]
generate_clean_filter_types()
if("set_filters" in signal.data)
filter_types = list()
for(var/gas in signal.data["set_filters"])
filter_types += gas
generate_clean_filter_types()
if("init" in signal.data)
name = signal.data["init"]

View File

@@ -223,7 +223,6 @@
var/alert_type = null
if(ispath(breathing_class))
breathing_class = breathing_classes[breathing_class]
var/list/gases = breathing_class.gases
alert_category = breathing_class.high_alert_category
alert_type = breathing_class.high_alert_datum
danger_reagent = breathing_class.danger_reagent