From cc2471cf7f056ab66048633a29aae3fdc0ed6dc3 Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Thu, 9 Sep 2021 13:51:22 -0700 Subject: [PATCH 1/4] Reworked supermatter gas output basically it's less likely to cause forever runaway trit fires... but it can still get runaway, it's just more power-based than temperature-based --- code/__DEFINES/maths.dm | 4 ++++ code/modules/power/supermatter/supermatter.dm | 24 ++++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/code/__DEFINES/maths.dm b/code/__DEFINES/maths.dm index f56cd76a71..37a2fe3746 100644 --- a/code/__DEFINES/maths.dm +++ b/code/__DEFINES/maths.dm @@ -222,6 +222,10 @@ /// 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 148535af76..4e68787c88 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -41,8 +41,9 @@ #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 PLASMA_RELEASE_MODIFIER 750 //Higher == less plasma released by reaction -#define OXYGEN_RELEASE_MODIFIER 325 //Higher == less oxygen released at high temperature/power +#define GAS_RELEASE_MODIFIER 500 //Higher == less gas released by reaction +#define MAX_OXY_MULT 3 //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 REACTION_POWER_MODIFIER 0.55 //Higher == more overall power @@ -538,14 +539,19 @@ 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/effective_temperature = min(removed.return_temperature(), 2500 * dynamic_heat_modifier) + var/cur_temp = removed.return_temperature() // more readable, better-performing anyway - 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)) + // 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 = max((device_energy**2 * dynamic_heat_modifier + (cur_temp - T0C)) / GAS_RELEASE_MODIFIER ** 2, 0) / (1+oxy_ratio) + + removed.adjust_moles(GAS_PLASMA, released_plasma) + + removed.adjust_moles(GAS_O2, released_plasma * oxy_ratio) if(removed.return_temperature() < max_temp_increase) removed.adjust_heat(device_energy * dynamic_heat_modifier * THERMAL_RELEASE_MODIFIER) From 3965ad9daed5cc103a05b8543829166496f87741 Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Sat, 11 Sep 2021 10:25:39 -0700 Subject: [PATCH 2/4] yeah that's just too much gas sorry --- code/modules/power/supermatter/supermatter.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 4e68787c88..f3642a5b98 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -547,7 +547,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) // 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 = max((device_energy**2 * dynamic_heat_modifier + (cur_temp - T0C)) / GAS_RELEASE_MODIFIER ** 2, 0) / (1+oxy_ratio) + var/released_plasma = min(max((device_energy * dynamic_heat_modifier + (cur_temp - T0C)) / GAS_RELEASE_MODIFIER, 0) / (1+oxy_ratio), 3) removed.adjust_moles(GAS_PLASMA, released_plasma) From 083704e29d0e1e521f84e555111c0b4cf4d83a81 Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Sat, 11 Sep 2021 11:03:15 -0700 Subject: [PATCH 3/4] lowered max oxy mult, made temp not matter --- code/modules/power/supermatter/supermatter.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index f3642a5b98..352864cead 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -42,7 +42,7 @@ #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 500 //Higher == less gas released by reaction -#define MAX_OXY_MULT 3 //The ratio between oxygen and plasma will approach this as temperature increases +#define MAX_OXY_MULT 1.5 //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 REACTION_POWER_MODIFIER 0.55 //Higher == more overall power @@ -547,7 +547,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) // 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 + (cur_temp - T0C)) / GAS_RELEASE_MODIFIER, 0) / (1+oxy_ratio), 3) + var/released_plasma = min(max((device_energy * dynamic_heat_modifier) / GAS_RELEASE_MODIFIER, 0) / (1+oxy_ratio), 3) removed.adjust_moles(GAS_PLASMA, released_plasma) From 137a30a047cc72e1c10e570055b0da535f57af11 Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Sun, 12 Sep 2021 15:04:42 -0700 Subject: [PATCH 4/4] more nerfs lol --- code/modules/power/supermatter/supermatter.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 352864cead..9b3f6f532d 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -41,8 +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 500 //Higher == less gas released by reaction -#define MAX_OXY_MULT 1.5 //The ratio between oxygen and plasma will approach this as temperature increases +#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 REACTION_POWER_MODIFIER 0.55 //Higher == more overall power @@ -547,7 +547,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) // 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), 3) + 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)