Fixes N2O not decomposing above 100000 Kelvin (#26817)

* Replaces the N2O decomposition function with one that is slightly above 0 at 1400 Kelvin and approaches 1 as temp increases.

* adds a min check to the calculation of the amount to decompose
This commit is contained in:
Migratingcocofruit
2024-10-02 18:20:40 +03:00
committed by GitHub
parent e9ea474d43
commit 07bd88a2ff
2 changed files with 16 additions and 13 deletions
@@ -574,21 +574,19 @@ What are the archived variables for?
var/energy_released = 0
var/old_heat_capacity = heat_capacity()
var/burned_fuel = 0
burned_fuel = min((1 - (N2O_DECOMPOSITION_COEFFICIENT_A / ((private_temperature + N2O_DECOMPOSITION_COEFFICIENT_C) ** 2))) * private_sleeping_agent, private_sleeping_agent)
private_sleeping_agent -= burned_fuel
burned_fuel = max(0, 0.00002 * (private_temperature - (0.00001 * (private_temperature ** 2)))) * private_sleeping_agent
if(private_sleeping_agent - burned_fuel > 0)
private_sleeping_agent -= burned_fuel
if(burned_fuel)
energy_released += (N2O_DECOMPOSITION_ENERGY_RELEASED * burned_fuel)
if(burned_fuel)
energy_released += (N2O_DECOMPOSITION_ENERGY_RELEASED * burned_fuel)
private_oxygen += burned_fuel * 0.5
private_nitrogen += burned_fuel
private_oxygen += burned_fuel * 0.5
private_nitrogen += burned_fuel
var/new_heat_capacity = heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
private_temperature = (private_temperature * old_heat_capacity + energy_released) / new_heat_capacity
reacting = TRUE
var/new_heat_capacity = heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
private_temperature = (private_temperature * old_heat_capacity + energy_released) / new_heat_capacity
reacting = TRUE
fuel_burnt = 0
//Handle plasma burning