From: Slava0135 <40753025+Slava0135@users.noreply.github.com>
Date: Thu, 9 Mar 2023 08:30:00 +0000 (+0300)
Subject: Add emp artifact effect (#14493)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=b874304d3833149dddd74add056d9b41ee1e2c4b;p=space-station-14.git
Add emp artifact effect (#14493)
---
diff --git a/Content.Server/Emp/EmpSystem.cs b/Content.Server/Emp/EmpSystem.cs
index 865f6a6947..2f348e4023 100644
--- a/Content.Server/Emp/EmpSystem.cs
+++ b/Content.Server/Emp/EmpSystem.cs
@@ -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
index 0000000000..dc37782a52
--- /dev/null
+++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Components/EmpArtifactComponent.cs
@@ -0,0 +1,17 @@
+using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
+
+namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
+
+///
+/// Artifact that EMP
+///
+[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
index 0000000000..c4346b51bc
--- /dev/null
+++ b/Content.Server/Xenoarchaeology/XenoArtifacts/Effects/Systems/EmpArtifactSystem.cs
@@ -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!;
+
+ ///
+ public override void Initialize()
+ {
+ SubscribeLocalEvent(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
diff --git a/Resources/Prototypes/XenoArch/Effects/normal_effects.yml b/Resources/Prototypes/XenoArch/Effects/normal_effects.yml
index e68e75fb0a..48d2855b9f 100644
--- a/Resources/Prototypes/XenoArch/Effects/normal_effects.yml
+++ b/Resources/Prototypes/XenoArch/Effects/normal_effects.yml
@@ -495,3 +495,10 @@
maxSpawns: 1
spawns:
- id: Singularity
+
+- type: artifactEffect
+ id: EffectEmp
+ targetDepth: 3
+ effectHint: artifact-effect-hint-electrical-interference
+ components:
+ - type: EmpArtifact