From ba9e7f8f25104efa61cefd4eb2d45458e5e3fd81 Mon Sep 17 00:00:00 2001 From: AbsFree Date: Sun, 15 Dec 2024 21:50:15 +0100 Subject: [PATCH] made the reaction exothermic, added efficiency based on temperature --- .../atmospherics/gasmixtures/reactions.dm | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/GainStation13/code/modules/atmospherics/gasmixtures/reactions.dm b/GainStation13/code/modules/atmospherics/gasmixtures/reactions.dm index a68553cf8e..ce34e8909b 100644 --- a/GainStation13/code/modules/atmospherics/gasmixtures/reactions.dm +++ b/GainStation13/code/modules/atmospherics/gasmixtures/reactions.dm @@ -12,6 +12,20 @@ /datum/gas_reaction/lipoifium_formation/react(datum/gas_mixture/air) // TODO: make the reaction exothermic, and make it more efficient at lower temperatures - air.adjust_moles(GAS_FAT, 1) - air.adjust_moles(GAS_PLASMA, -1) - air.adjust_moles(GAS_N2, -1) + var/temperature = air.return_temperature() + var/reaction_efficiency = 0 + if (temperature <= 5) + reaction_efficiency = 1 + else if (temperature >= 100) + return NO_REACTION + else + reaction_efficiency = -((temperature - 5) / 95) + 1 // will equal 1 at 5 kelvin, and will linearly fall until 0 at 100k + + var/energy_released = reaction_efficiency*FIRE_CARBON_ENERGY_RELEASED + air.adjust_moles(GAS_FAT, reaction_efficiency) + air.adjust_moles(GAS_PLASMA, -reaction_efficiency / 2) + air.adjust_moles(GAS_N2, -reaction_efficiency / 2) + var/heat_capacity = air.heat_capacity() + air.set_temperature(max(temperature + energy_released / heat_capacity, TCMB)) + + return REACTING