From c7a887cd045616aa9deab28fd810c597bb96d741 Mon Sep 17 00:00:00 2001 From: HelmCrab <90987989+Thera-Pissed@users.noreply.github.com> Date: Sun, 25 Aug 2024 10:58:31 -0500 Subject: [PATCH] TEG efficiency code tweaks. (#3220) ## About The Pull Request Code is [from citadel](https://github.com/Citadel-Station-13/Citadel-Station-13) [this PR in particular](https://github.com/Citadel-Station-13/Citadel-Station-13/pull/15362) Tweaks TEG code to have efficiency dependent on temperature delta, instead of whatever the hell whitesands was doing. This also results in there no longer being an upper cap on TEG output. Go for a highscore. ![image](https://github.com/user-attachments/assets/a26719b5-9a05-4c92-97dc-65188b415709) desmos graph if you want to play with numbers: Y\ =\frac{0.45}{1+\left(e^{-0.0009\cdot\left(X\ -\ 10000\right)\ }\right)} ## Why It's Good For The Game more thermodynamically good is better! makes room for more accurate and balanced TEGs also tmtmtl said this was a good and easy first step towards better TEGs. ## Changelog :cl: code: TEG efficiency now depends on temperature delta. /:cl: --- code/modules/power/generator.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 8d711ad804fa..c9367ceecfbe 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -13,6 +13,7 @@ var/lastgen = 0 var/lastgenlev = -1 + var/max_efficiency = 0.45 /obj/machinery/power/generator/Initialize(mapload) . = ..() @@ -75,12 +76,13 @@ if(delta_temperature > 0 && cold_air_heat_capacity > 0 && hot_air_heat_capacity > 0) - var/efficiency = 0.45 //WS Edit - Nerfed down to Cit's efficiency + var/efficiency = LOGISTIC_FUNCTION(max_efficiency,0.0009,delta_temperature,10000) + //2nd (0.0009) effects how 'steep' the curve is, and 4th (10000) effects where the 'middle' is. var/energy_transfer = delta_temperature*hot_air_heat_capacity*cold_air_heat_capacity/(hot_air_heat_capacity+cold_air_heat_capacity) + lastgen += energy_transfer * efficiency var/heat = energy_transfer*(1-efficiency) - lastgen += LOGISTIC_FUNCTION(500000,0.0009,delta_temperature,10000) //WS Edit - Buries the 3x3 freezer heater TEG into the ground hot_air.set_temperature(hot_air.return_temperature() - energy_transfer/hot_air_heat_capacity) cold_air.set_temperature(cold_air.return_temperature() + heat/cold_air_heat_capacity)