Predict EMP Examine (#39419)

* another one bites the dust

* Update Content.Shared/Emp/SharedEmpSystem.cs

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
Kyle Tyo 2025-08-06 10:25:24 -04:00 committed by Vanessa
parent 7e2b405b25
commit e04f554ced
2 changed files with 21 additions and 25 deletions

View File

@ -4,8 +4,6 @@ using Content.Server.Power.EntitySystems;
using Content.Server.Radio;
using Content.Server.SurveillanceCamera;
using Content.Shared.Emp;
using Content.Shared.Examine;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Content.Shared._NF.Emp.Components; // Frontier
using Robust.Server.GameStates; // Frontier: EMP Blast PVS
@ -17,7 +15,6 @@ namespace Content.Server.Emp;
public sealed class EmpSystem : SharedEmpSystem
{
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly PvsOverrideSystem _pvs = default!; // Frontier: EMP Blast PVS
[Dependency] private readonly IConfigurationManager _cfg = default!; // Frontier: EMP Blast PVS
@ -26,7 +23,6 @@ public sealed class EmpSystem : SharedEmpSystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<EmpDisabledComponent, ExaminedEvent>(OnExamine);
SubscribeLocalEvent<EmpDisabledComponent, RadioSendAttemptEvent>(OnRadioSendAttempt);
SubscribeLocalEvent<EmpDisabledComponent, RadioReceiveAttemptEvent>(OnRadioReceiveAttempt);
@ -119,15 +115,15 @@ public sealed class EmpSystem : SharedEmpSystem
if (damage == null) damage = new() { DamageDict = new() { { "Ion", 80 } } }; // DeltaV - EMP damage
var ev = new EmpPulseEvent(energyConsumption, false, false, TimeSpan.FromSeconds(duration));
RaiseLocalEvent(uid, ref ev);
if (ev.Affected)
{
Spawn(EmpDisabledEffectPrototype, Transform(uid).Coordinates);
}
if (ev.Disabled)
{
var disabled = EnsureComp<EmpDisabledComponent>(uid);
disabled.DisabledUntil = Timing.CurTime + TimeSpan.FromSeconds(duration);
}
if (!ev.Disabled)
return;
var disabled = EnsureComp<EmpDisabledComponent>(uid);
disabled.DisabledUntil = Timing.CurTime + TimeSpan.FromSeconds(duration);
}
public override void Update(float frameTime)
@ -146,19 +142,6 @@ public sealed class EmpSystem : SharedEmpSystem
}
}
private void OnExamine(EntityUid uid, EmpDisabledComponent component, ExaminedEvent args)
{
args.PushMarkup(Loc.GetString("emp-disabled-comp-on-examine"));
}
/* Removed in Trigger Refactor
private void HandleEmpTrigger(EntityUid uid, EmpOnTriggerComponent comp, TriggerEvent args)
{
EmpPulse(_transform.GetMapCoordinates(uid), comp.Range, comp.EnergyConsumption, comp.DisableDuration, comp.Damage); // DeltaV - EMP damage
args.Handled = true;
}
*/
private void OnRadioSendAttempt(EntityUid uid, EmpDisabledComponent component, ref RadioSendAttemptEvent args)
{
args.Cancelled = true;
@ -185,7 +168,7 @@ public sealed class EmpSystem : SharedEmpSystem
/// </summary>
public sealed partial class EmpAttemptEvent(DamageSpecifier? damage = null) : CancellableEntityEventArgs // DeltaV - EMP damage
{
public DamageSpecifier? Damage = (damage == null) ? new() { DamageDict = new() { {"Ion", 80 } } } : damage; // DeltaV - EMP damage;
public DamageSpecifier? Damage = (damage == null) ? new() { DamageDict = new() { { "Ion", 80 } } } : damage; // DeltaV - EMP damage;
}
[ByRefEvent]

View File

@ -1,3 +1,4 @@
using Content.Shared.Examine;
using Robust.Shared.Map;
using Robust.Shared.Timing;
@ -7,6 +8,13 @@ public abstract class SharedEmpSystem : EntitySystem
{
[Dependency] protected readonly IGameTiming Timing = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<EmpDisabledComponent, ExaminedEvent>(OnExamine);
}
protected const string EmpDisabledEffectPrototype = "EffectEmpDisabled";
/// <summary>
@ -19,4 +27,9 @@ public abstract class SharedEmpSystem : EntitySystem
public virtual void EmpPulse(MapCoordinates coordinates, float range, float energyConsumption, float duration)
{
}
private void OnExamine(Entity<EmpDisabledComponent> ent, ref ExaminedEvent args)
{
args.PushMarkup(Loc.GetString("emp-disabled-comp-on-examine"));
}
}