]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix TEG acting as infinite energy source on destruction (#29972)
authorLuiz Costa <33888056+luizwritescode@users.noreply.github.com>
Thu, 19 Sep 2024 02:15:44 +0000 (23:15 -0300)
committerGitHub <noreply@github.com>
Thu, 19 Sep 2024 02:15:44 +0000 (12:15 +1000)
* TEG now checks for power supply before checking for IsFullyBuilt

* Update Content.Server/Power/Generation/Teg/TegSystem.cs

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
Content.Server/Power/Generation/Teg/TegSystem.cs

index 9fb7d5ff1f649b2ada5d76afa67b326006254d33..027f25704023705c67fa724808d7dd28f5553b61 100644 (file)
@@ -102,10 +102,6 @@ public sealed class TegSystem : EntitySystem
 
     private void GeneratorUpdate(EntityUid uid, TegGeneratorComponent component, ref AtmosDeviceUpdateEvent args)
     {
-        var tegGroup = GetNodeGroup(uid);
-        if (tegGroup is not { IsFullyBuilt: true })
-            return;
-
         var supplier = Comp<PowerSupplierComponent>(uid);
         var powerReceiver = Comp<ApcPowerReceiverComponent>(uid);
         if (!powerReceiver.Powered)
@@ -114,6 +110,10 @@ public sealed class TegSystem : EntitySystem
             return;
         }
 
+        var tegGroup = GetNodeGroup(uid);
+        if (tegGroup is not { IsFullyBuilt: true })
+            return;
+
         var circA = tegGroup.CirculatorA!.Owner;
         var circB = tegGroup.CirculatorB!.Owner;