From 5b98f08bc06f9f3ca433fe5d1f94f2d051ca89cb Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 1 Feb 2021 14:24:24 +0100 Subject: [PATCH] [MIRROR] Trit & H2 Consistency Fix (#2999) * Trit & H2 Consistency Fix (#56265) Make the reactions for trit and h2 fires more consistent with other gas reactions * Trit & H2 Consistency Fix Co-authored-by: vincentiusvin <54709710+vincentiusvin@users.noreply.github.com> --- code/__DEFINES/reactions.dm | 3 +- .../atmospherics/gasmixtures/reactions.dm | 50 ++++++++++++------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/code/__DEFINES/reactions.dm b/code/__DEFINES/reactions.dm index e3847207ea1..62a34200de5 100644 --- a/code/__DEFINES/reactions.dm +++ b/code/__DEFINES/reactions.dm @@ -7,7 +7,8 @@ #define PLASMA_MINIMUM_OXYGEN_NEEDED 2 #define PLASMA_MINIMUM_OXYGEN_PLASMA_RATIO 30 #define FIRE_CARBON_ENERGY_RELEASED 100000 //Amount of heat released per mole of burnt carbon into the tile -#define FIRE_HYDROGEN_ENERGY_RELEASED 280000 //Amount of heat released per mole of burnt hydrogen and/or tritium(hydrogen isotope) +#define FIRE_HYDROGEN_ENERGY_RELEASED 2800000 //Amount of heat released per mole of burnt hydrogen and/or tritium(hydrogen isotope) +#define FIRE_HYDROGEN_ENERGY_WEAK 280000 #define FIRE_PLASMA_ENERGY_RELEASED 3000000 //Amount of heat released per mole of burnt plasma into the tile //General assmos defines. #define WATER_VAPOR_FREEZE 200 diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm index c778781a122..8ba9ac4b5f9 100644 --- a/code/modules/atmospherics/gasmixtures/reactions.dm +++ b/code/modules/atmospherics/gasmixtures/reactions.dm @@ -160,23 +160,32 @@ nobiliumsuppression = INFINITY cached_results["fire"] = 0 var/turf/open/location = isturf(holder) ? holder : null var/burned_fuel = 0 + if(cached_gases[/datum/gas/oxygen][MOLES] < cached_gases[/datum/gas/tritium][MOLES] || MINIMUM_TRIT_OXYBURN_ENERGY > air.thermal_energy()) burned_fuel = cached_gases[/datum/gas/oxygen][MOLES] / TRITIUM_BURN_OXY_FACTOR cached_gases[/datum/gas/tritium][MOLES] -= burned_fuel - else - burned_fuel = cached_gases[/datum/gas/tritium][MOLES] * TRITIUM_BURN_TRIT_FACTOR - cached_gases[/datum/gas/tritium][MOLES] -= cached_gases[/datum/gas/tritium][MOLES] / TRITIUM_BURN_TRIT_FACTOR - cached_gases[/datum/gas/oxygen][MOLES] -= cached_gases[/datum/gas/tritium][MOLES] - - if(burned_fuel) - energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel) - if(location && prob(10) && burned_fuel > TRITIUM_MINIMUM_RADIATION_ENERGY) //woah there let's not crash the server - radiation_pulse(location, energy_released / TRITIUM_BURN_RADIOACTIVITY_FACTOR) ASSERT_GAS(/datum/gas/water_vapor, air) //oxygen+more-or-less hydrogen=H2O cached_gases[/datum/gas/water_vapor][MOLES] += burned_fuel / TRITIUM_BURN_OXY_FACTOR + energy_released += (FIRE_HYDROGEN_ENERGY_WEAK * burned_fuel) cached_results["fire"] += burned_fuel + + else + burned_fuel = cached_gases[/datum/gas/tritium][MOLES] + + cached_gases[/datum/gas/tritium][MOLES] -= burned_fuel / TRITIUM_BURN_TRIT_FACTOR + cached_gases[/datum/gas/oxygen][MOLES] -= burned_fuel + + ASSERT_GAS(/datum/gas/water_vapor, air) //oxygen+more-or-less hydrogen=H2O + cached_gases[/datum/gas/water_vapor][MOLES] += burned_fuel / TRITIUM_BURN_TRIT_FACTOR + + energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel) + cached_results["fire"] += burned_fuel * 10 + + if(burned_fuel) + if(location && prob(10) && burned_fuel > TRITIUM_MINIMUM_RADIATION_ENERGY) //woah there let's not crash the server + radiation_pulse(location, energy_released / TRITIUM_BURN_RADIOACTIVITY_FACTOR) if(energy_released > 0) var/new_heat_capacity = air.heat_capacity() @@ -343,21 +352,27 @@ nobiliumsuppression = INFINITY var/turf/open/location = isturf(holder) ? holder : null var/burned_fuel = 0 if(cached_gases[/datum/gas/oxygen][MOLES] < cached_gases[/datum/gas/hydrogen][MOLES] || MINIMUM_H2_OXYBURN_ENERGY > air.thermal_energy()) - burned_fuel = cached_gases[/datum/gas/oxygen][MOLES]/HYDROGEN_BURN_OXY_FACTOR + burned_fuel = cached_gases[/datum/gas/oxygen][MOLES] / HYDROGEN_BURN_OXY_FACTOR cached_gases[/datum/gas/hydrogen][MOLES] -= burned_fuel - else - burned_fuel = cached_gases[/datum/gas/hydrogen][MOLES] * HYDROGEN_BURN_H2_FACTOR - cached_gases[/datum/gas/hydrogen][MOLES] -= cached_gases[/datum/gas/hydrogen][MOLES] / HYDROGEN_BURN_H2_FACTOR - cached_gases[/datum/gas/oxygen][MOLES] -= cached_gases[/datum/gas/hydrogen][MOLES] - - if(burned_fuel) - energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel) ASSERT_GAS(/datum/gas/water_vapor, air) //oxygen+more-or-less hydrogen=H2O cached_gases[/datum/gas/water_vapor][MOLES] += burned_fuel / HYDROGEN_BURN_OXY_FACTOR + energy_released += (FIRE_HYDROGEN_ENERGY_WEAK * burned_fuel) cached_results["fire"] += burned_fuel + else + burned_fuel = cached_gases[/datum/gas/hydrogen][MOLES] + + cached_gases[/datum/gas/hydrogen][MOLES] -= burned_fuel / HYDROGEN_BURN_H2_FACTOR + cached_gases[/datum/gas/oxygen][MOLES] -= burned_fuel + + ASSERT_GAS(/datum/gas/water_vapor, air) //oxygen+more-or-less hydrogen=H2O + cached_gases[/datum/gas/water_vapor][MOLES] += burned_fuel / HYDROGEN_BURN_H2_FACTOR + + energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel) + cached_results["fire"] += burned_fuel * 10 + if(energy_released > 0) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) @@ -481,7 +496,6 @@ nobiliumsuppression = INFINITY /datum/gas/plasma = 10 ) - /datum/gas_reaction/bzformation/react(datum/gas_mixture/air) var/list/cached_gases = air.gases var/temperature = air.temperature