From d40c4e191f28e80d0b03f5ab1baabc5a613ef29c Mon Sep 17 00:00:00 2001 From: Pickle-Coding <58013024+Pickle-Coding@users.noreply.github.com> Date: Tue, 29 Nov 2022 09:05:05 +0000 Subject: [PATCH] Fixes gas turbine scaling its output mix thermal energy, and prevents it from creating power from thermal energy it can't take. (#71411) ## About The Pull Request Removes errant mole scaling for the thermal energy loss of gases entering the turbine. Limits the amount of work it can do to only cool gas down to TCMB, preventing it from creating power from no thermal energy. ## Why It's Good For The Game It was too silly when the turbine can cool a raging fire down to 2.7 Kelvin. Creating power from energy it can't take was also too silly. ## Changelog :cl: fix: Fix unnecessary mole scaling with gas turbine gas thermal energy loss from work done. fix: The gas turbine no longer creates power from thermal energy it can't take. /:cl: --- code/modules/power/turbine/turbine.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/power/turbine/turbine.dm b/code/modules/power/turbine/turbine.dm index d86a9088d4a..521dc342972 100644 --- a/code/modules/power/turbine/turbine.dm +++ b/code/modules/power/turbine/turbine.dm @@ -565,7 +565,8 @@ var/output_mix_heat_capacity = output_mix.heat_capacity() if(!output_mix_heat_capacity) return 0 - output_mix.temperature = max((output_mix.temperature * output_mix_heat_capacity + work_done * output_mix.total_moles() * TURBINE_HEAT_CONVERSION_MULTIPLIER) / output_mix_heat_capacity, TCMB) + work_done = min(work_done, (output_mix_heat_capacity * output_mix.temperature - output_mix_heat_capacity * TCMB) / TURBINE_HEAT_CONVERSION_MULTIPLIER) + output_mix.temperature = max((output_mix.temperature * output_mix_heat_capacity + work_done * TURBINE_HEAT_CONVERSION_MULTIPLIER) / output_mix_heat_capacity, TCMB) return work_done /obj/item/paper/guides/jobs/atmos/turbine