]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
emp on electro supercritical (#15235)
authordeltanedas <39013340+deltanedas@users.noreply.github.com>
Mon, 24 Apr 2023 00:11:23 +0000 (00:11 +0000)
committerGitHub <noreply@github.com>
Mon, 24 Apr 2023 00:11:23 +0000 (10:11 +1000)
Co-authored-by: deltanedas <@deltanedas:kde.org>
Content.Server/Anomaly/Effects/ElectricityAnomalySystem.cs
Content.Shared/Anomaly/Effects/Components/ElectricityAnomalyComponent.cs

index 6c473d3570864efb2b5260fd5e0225f728bbfcdb..89a6361635a67038b0770f001a4f1d2cb9da9e62 100644 (file)
@@ -1,4 +1,5 @@
 using Content.Server.Electrocution;
+using Content.Server.Emp;
 using Content.Server.Lightning;
 using Content.Server.Power.Components;
 using Content.Shared.Anomaly.Components;
@@ -16,6 +17,7 @@ public sealed class ElectricityAnomalySystem : EntitySystem
     [Dependency] private readonly IRobustRandom _random = default!;
     [Dependency] private readonly LightningSystem _lightning = default!;
     [Dependency] private readonly ElectrocutionSystem _electrocution = default!;
+    [Dependency] private readonly EmpSystem _emp = default!;
     [Dependency] private readonly EntityLookupSystem _lookup = default!;
 
     /// <inheritdoc/>
@@ -55,6 +57,9 @@ public sealed class ElectricityAnomalySystem : EntitySystem
         {
             _lightning.ShootLightning(uid, ent);
         }
+
+        var empRange = component.MaxElectrocuteRange * 3;
+        _emp.EmpPulse(Transform(uid).MapPosition, empRange, component.EmpEnergyConsumption);
     }
 
     public override void Update(float frameTime)
index 9afdd0aaa2f49ce747e49543b111f9e44129f94a..8da6dd4c42edd855b7cc6a1e2f28884d1b36bab4 100644 (file)
@@ -38,4 +38,10 @@ public sealed class ElectricityAnomalyComponent : Component
     /// </summary>
     [DataField("nextSecond", customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
     public TimeSpan NextSecond = TimeSpan.Zero;
+
+    /// <summary>
+    /// Energy consumed from devices by the emp pulse upon going supercritical.
+    /// <summary>
+    [DataField("empEnergyConsumption"), ViewVariables(VVAccess.ReadWrite)]
+    public float EmpEnergyConsumption = 100000f;
 }