made the reaction exothermic, added efficiency based on temperature

This commit is contained in:
AbsFree
2024-12-15 21:50:15 +01:00
parent c84583f817
commit ba9e7f8f25
@@ -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