[MIRROR] [WEBEDIT INCOMING] Fixes supermatter powerloss threshold check. [MDB IGNORE] (#17309)

* [WEBEDIT INCOMING] Fixes supermatter powerloss threshold check. (#70817)

Replaces the internal_energy is below powerloss_linear_threshold check with a momentary_power is below powerloss_linear_threshold check.

Fixes supermatter powerloss threshold check to check for the momentary power instead of internal energy.

The powerloss math is based on the momentary power, but the if check checked for the internal_energy instead, which made it continue using cubic power loss at inappropriate situations.

* [WEBEDIT INCOMING] Fixes supermatter powerloss threshold check.

Co-authored-by: Pickle-Coding <58013024+Pickle-Coding@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-11-02 18:41:19 +01:00
committed by GitHub
parent 3a7f6d69d7
commit 728be9f1be
@@ -571,7 +571,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
var/momentary_power = internal_energy
for(var/powergain_type in additive_power)
momentary_power += additive_power[powergain_type]
if(internal_energy < powerloss_linear_threshold) // Negative numbers
if(momentary_power < powerloss_linear_threshold) // Negative numbers
additive_power[SM_POWER_POWERLOSS] = -1 * (momentary_power / POWERLOSS_CUBIC_DIVISOR) ** 3
else
additive_power[SM_POWER_POWERLOSS] = -1 * (momentary_power * POWERLOSS_LINEAR_RATE + powerloss_linear_offset)