From 99908e17c56137a4ca02272e773128fa2568d968 Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Mon, 13 Sep 2021 11:39:32 -0700 Subject: [PATCH] Revert "Reworks supermatter gas output to be less cascade-y, more risky" --- code/__DEFINES/maths.dm | 4 ---- code/modules/power/supermatter/supermatter.dm | 24 +++++++------------ 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/code/__DEFINES/maths.dm b/code/__DEFINES/maths.dm index 37a2fe3746..f56cd76a71 100644 --- a/code/__DEFINES/maths.dm +++ b/code/__DEFINES/maths.dm @@ -222,10 +222,6 @@ /// k is the rate at which is approaches L, x_0 is the point where the function = 0 #define LOGISTIC_FUNCTION(L,k,x,x_0) (L/(1+(NUM_E**(-k*(x-x_0))))) // ) -/// A function that "linearly" approaches a maximum value of L -/// k is the rate at which it approaches L (), x_0 is the point where the function = 0 -#define HYPERBOLIC_GROWTH(L,k,x,x_0) ((-(L * L) / ((k * x) + L - (k * x_0))) + L) -// ) /// Make sure something is a boolean TRUE/FALSE 1/0 value, since things like bitfield & bitflag doesn't always give 1s and 0s. #define FORCE_BOOLEAN(x) ((x)? TRUE : FALSE) // ) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index d7c918007e..a759523dd0 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -41,9 +41,8 @@ #define THERMAL_RELEASE_MODIFIER 350 //Higher == more heat released during reaction, not to be confused with the above values #define THERMAL_RELEASE_CAP_MODIFIER 250 //Higher == lower cap on how much heat can be released per tick--currently 1.3x old value -#define GAS_RELEASE_MODIFIER 800 //Higher == less gas released by reaction -#define MAX_OXY_MULT 2 //The ratio between oxygen and plasma will approach this as temperature increases -#define OXY_POINT 80 // the temperature above which oxygen output > plasma output +#define PLASMA_RELEASE_MODIFIER 750 //Higher == less plasma released by reaction +#define OXYGEN_RELEASE_MODIFIER 325 //Higher == less oxygen released at high temperature/power #define REACTION_POWER_MODIFIER 0.55 //Higher == more overall power @@ -539,19 +538,14 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) //Power * 0.55 * a value between 1 and 0.8 var/device_energy = power * REACTION_POWER_MODIFIER - var/cur_temp = removed.return_temperature() // more readable, better-performing anyway + var/effective_temperature = min(removed.return_temperature(), 2500 * dynamic_heat_modifier) - // we don't want to cap the temperature like the old supermatter but we do want to stop adding more when it's too hot - var/max_temp_increase = min(cur_temp, 2500 * dynamic_heat_modifier) + ((device_energy * dynamic_heat_modifier) / THERMAL_RELEASE_CAP_MODIFIER) - - // oxygen ratio increases as temperature does - var/oxy_ratio = HYPERBOLIC_GROWTH(MAX_OXY_MULT, 1 / OXY_POINT, cur_temp, (-OXY_POINT / 2)) - // total moles also increases as temperature does - var/released_plasma = min(max((device_energy * dynamic_heat_modifier) / GAS_RELEASE_MODIFIER, 0) / (1+oxy_ratio), 2) - - removed.adjust_moles(GAS_PLASMA, released_plasma) - - removed.adjust_moles(GAS_O2, released_plasma * oxy_ratio) + var/max_temp_increase = effective_temperature + ((device_energy * dynamic_heat_modifier) / THERMAL_RELEASE_CAP_MODIFIER) + //Calculate how much gas to release + //Varies based on power and gas content + removed.adjust_moles(GAS_PLASMA, max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0)) + //Varies based on power, gas content, and heat + removed.adjust_moles(GAS_O2, max(((device_energy + effective_temperature * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER, 0)) if(removed.return_temperature() < max_temp_increase) removed.adjust_heat(device_energy * dynamic_heat_modifier * THERMAL_RELEASE_MODIFIER)