]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add emp artifact effect (#14493)
authorSlava0135 <40753025+Slava0135@users.noreply.github.com>
Thu, 9 Mar 2023 08:30:00 +0000 (11:30 +0300)
committerGitHub <noreply@github.com>
Thu, 9 Mar 2023 08:30:00 +0000 (00:30 -0800)
Content.Server/Emp/EmpSystem.cs
Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Components/EmpArtifactComponent.cs [new file with mode: 0644]
Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/EmpArtifactSystem.cs [new file with mode: 0644]
Resources/Prototypes/XenoArch/Effects/normal_effects.yml

index 865f6a694797c0290f169d991acf556a1bceaa09..2f348e4023764ac83626bb937b51faadc203b37f 100644 (file)
@@ -30,7 +30,7 @@ public sealed class EmpSystem : EntitySystem
 
     private void HandleEmpTrigger(EntityUid uid, EmpOnTriggerComponent comp, TriggerEvent args)
     {
-        EmpPulse(Transform(uid).Coordinates.ToMap(EntityManager), comp.Range, comp.EnergyConsumption);
+        EmpPulse(Transform(uid).MapPosition, comp.Range, comp.EnergyConsumption);
         args.Handled = true;
     }
 }
diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Components/EmpArtifactComponent.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Components/EmpArtifactComponent.cs
new file mode 100644 (file)
index 0000000..dc37782
--- /dev/null
@@ -0,0 +1,17 @@
+using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
+
+namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
+
+/// <summary>
+/// Artifact that EMP
+/// </summary>
+[RegisterComponent]
+[Access(typeof(EmpArtifactSystem))]
+public sealed class EmpArtifactComponent : Component
+{
+    [DataField("range"), ViewVariables(VVAccess.ReadWrite)]
+    public float Range = 4f;
+
+    [DataField("energyConsumption"), ViewVariables(VVAccess.ReadWrite)]
+    public float EnergyConsumption = 1000000;
+}
diff --git a/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/EmpArtifactSystem.cs b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/EmpArtifactSystem.cs
new file mode 100644 (file)
index 0000000..c4346b5
--- /dev/null
@@ -0,0 +1,21 @@
+using Content.Server.Emp;
+using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
+using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
+
+namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
+
+public sealed class EmpArtifactSystem : EntitySystem
+{
+    [Dependency] private readonly EmpSystem _emp = default!;
+
+    /// <inheritdoc/>
+    public override void Initialize()
+    {
+        SubscribeLocalEvent<EmpArtifactComponent, ArtifactActivatedEvent>(OnActivate);
+    }
+
+    private void OnActivate(EntityUid uid, EmpArtifactComponent component, ArtifactActivatedEvent args)
+    {
+        _emp.EmpPulse(Transform(uid).MapPosition, component.Range, component.EnergyConsumption);
+    }
+}
\ No newline at end of file
index e68e75fb0aa73f3312a2c6873574ec3de5125067..48d2855b9f9c1175ef1922bd95cce7f2c11affec 100644 (file)
     maxSpawns: 1
     spawns:
     - id: Singularity
+
+- type: artifactEffect
+  id: EffectEmp
+  targetDepth: 3
+  effectHint: artifact-effect-hint-electrical-interference
+  components:
+  - type: EmpArtifact