Add emp artifact effect (#14493)

This commit is contained in:
Slava0135 2023-03-09 11:30:00 +03:00 committed by GitHub
parent f9aaadcfc5
commit b874304d38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 1 deletions

View 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;
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -495,3 +495,10 @@
maxSpawns: 1
spawns:
- id: Singularity
- type: artifactEffect
id: EffectEmp
targetDepth: 3
effectHint: artifact-effect-hint-electrical-interference
components:
- type: EmpArtifact