]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
TEG can power itself when turned on (#29072)
authorWarMechanic <69510347+WarMechanic@users.noreply.github.com>
Sun, 23 Jun 2024 01:46:31 +0000 (11:46 +1000)
committerGitHub <noreply@github.com>
Sun, 23 Jun 2024 01:46:31 +0000 (18:46 -0700)
Content.Server/Power/Generation/Teg/TegSystem.cs

index 02412ca5fb54b5f59484537c3706147ef44a8c50..30b846bd823b389412064e19cb2df019f5708636 100644 (file)
@@ -181,7 +181,12 @@ public sealed class TegSystem : EntitySystem
         // Turn energy (at atmos tick rate) into wattage.
         var power = electricalEnergy / args.dt;
         // Add ramp factor. This magics slight power into existence, but allows us to ramp up.
-        supplier.MaxSupply = power * component.RampFactor;
+        power *= component.RampFactor;
+
+        // Simulate TEG powering itself after being started up. This means that if LV is lost this keeps running.
+        const float load = 1000;
+        supplier.MaxSupply = Math.Max(power - load, 0);
+        powerReceiver.Load = Math.Max(load - power, 0);
 
         var circAComp = Comp<TegCirculatorComponent>(circA);
         var circBComp = Comp<TegCirculatorComponent>(circB);