EMP systems fixes
This commit is contained in:
parent
d4980c0b9f
commit
cf05c060b3
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Server.Power.Components; // ough BatteryComponent why are you in server
|
||||
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Server.PowerCell;
|
||||
using Content.Shared._DV.Augments;
|
||||
|
|
@ -8,6 +8,7 @@ using Content.Shared.Body.Systems;
|
|||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Power.Components; // ough BatteryComponent why are you in server
|
||||
using Content.Shared.PowerCell.Components;
|
||||
|
||||
namespace Content.Server._DV.Augments;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Content.Server.Emp;
|
||||
using Content.Shared.Emp;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared._DV.Silicons;
|
||||
|
||||
|
|
@ -12,12 +12,11 @@ public sealed class SiliconEmpSystem : EntitySystem
|
|||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SiliconEmpComponent, EmpAttemptEvent>(OnEmp);
|
||||
SubscribeLocalEvent<SiliconEmpComponent, EmpPulseEvent>(OnEmpPulse);
|
||||
}
|
||||
|
||||
private void OnEmp(Entity<SiliconEmpComponent> ent, ref EmpAttemptEvent args)
|
||||
private void OnEmpPulse(Entity<SiliconEmpComponent> ent, ref EmpPulseEvent args)
|
||||
{
|
||||
args.Cancel(); // Stop all the normal effects of the EMP
|
||||
if (args.Damage is not { } damage) return;
|
||||
_damageable.TryChangeDamage(ent, damage / 2, false); // Damage is divided by 2 because the event is raised twice (once from entity itself, and another is relayed from it's power cell) and I'm too lazy for an actual fix - NoElka | Make EMP not ignore armor.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System.Linq;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Power.Components;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.PowerCell.Components;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using Content.Server.Electrocution;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Electrocution;
|
||||
using Robust.Shared.Random;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using Robust.Shared.Random;
|
||||
using Content.Shared._EE.Silicon.Components;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Power.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Shared.Atmos.Components;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Power.Components;
|
||||
using Content.Shared._EE.Silicon.Systems;
|
||||
using Content.Shared.Bed.Sleep;
|
||||
using Content.Server._EE.Silicon.Charge;
|
||||
using Content.Server._EE.Power.Components;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Shared.Humanoid;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using Content.Server.Emp;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.Body.Organ;
|
||||
using Content.Shared.Emp;
|
||||
using Content.Shared._Shitmed.Body.Organ;
|
||||
using Content.Shared._Shitmed.Body.Events;
|
||||
using Content.Shared._Shitmed.Cybernetics;
|
||||
|
|
@ -12,7 +12,7 @@ internal sealed class CyberneticsSystem : EntitySystem
|
|||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<CyberneticsComponent, EmpPulseEvent>(OnEmpPulse);
|
||||
SubscribeLocalEvent<CyberneticsComponent, EmpDisabledRemoved>(OnEmpDisabledRemoved);
|
||||
SubscribeLocalEvent<CyberneticsComponent, EmpDisabledRemovedEvent>(OnEmpDisabledRemoved);
|
||||
}
|
||||
private void OnEmpPulse(Entity<CyberneticsComponent> cyberEnt, ref EmpPulseEvent ev)
|
||||
{
|
||||
|
|
@ -35,7 +35,7 @@ internal sealed class CyberneticsSystem : EntitySystem
|
|||
}
|
||||
}
|
||||
|
||||
private void OnEmpDisabledRemoved(Entity<CyberneticsComponent> cyberEnt, ref EmpDisabledRemoved ev)
|
||||
private void OnEmpDisabledRemoved(Entity<CyberneticsComponent> cyberEnt, ref EmpDisabledRemovedEvent ev)
|
||||
{
|
||||
if (cyberEnt.Comp.Disabled)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@ using Robust.Shared.Map;
|
|||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Shared._NF.Emp.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Configuration; // Frontier
|
||||
using Robust.Shared;
|
||||
using Content.Shared.Damage; // Frontier
|
||||
|
||||
namespace Content.Shared.Emp;
|
||||
|
||||
|
|
@ -16,6 +21,8 @@ public abstract class SharedEmpSystem : EntitySystem
|
|||
[Dependency] private readonly INetManager _net = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly SharedPvsOverrideSystem _pvs = default!; // Frontier
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!; // Frontier: EMP Blast PVS
|
||||
|
||||
private HashSet<EntityUid> _entSet = new();
|
||||
|
||||
|
|
@ -28,7 +35,7 @@ public abstract class SharedEmpSystem : EntitySystem
|
|||
SubscribeLocalEvent<EmpDisabledComponent, RejuvenateEvent>(OnRejuvenate);
|
||||
}
|
||||
|
||||
public static readonly EntProtoId EmpPulseEffectPrototype = "EffectEmpPulse";
|
||||
public static readonly EntProtoId EmpPulseEffectPrototype = "EffectEmpBlast"; // Frontier - was EffectEmpPulse
|
||||
public static readonly EntProtoId EmpDisabledEffectPrototype = "EffectEmpDisabled";
|
||||
public static readonly SoundSpecifier EmpSound = new SoundPathSpecifier("/Audio/Effects/Lightning/lightningbolt.ogg");
|
||||
|
||||
|
|
@ -47,8 +54,18 @@ public abstract class SharedEmpSystem : EntitySystem
|
|||
TryEmpEffects(uid, energyConsumption, duration, user);
|
||||
}
|
||||
// TODO: replace with PredictedSpawn once it works with animated sprites
|
||||
// TODO: replace with PredictedSpawn once it works with animated sprites
|
||||
if (_net.IsServer)
|
||||
Spawn(EmpPulseEffectPrototype, mapCoordinates);
|
||||
{
|
||||
var emp = Spawn(EmpPulseEffectPrototype, mapCoordinates); // Frontier: Added visual effect
|
||||
EnsureComp<EmpBlastComponent>(emp, out var empBlast); // Frontier
|
||||
empBlast.VisualRange = range; // Frontier
|
||||
|
||||
if (range > _cfg.GetCVar(CVars.NetMaxUpdateRange)) // Frontier
|
||||
_pvs.AddGlobalOverride(emp); // Frontier
|
||||
|
||||
Dirty(emp, empBlast); // Frontier
|
||||
}
|
||||
|
||||
var coordinates = _transform.ToCoordinates(mapCoordinates);
|
||||
_audio.PlayPredicted(EmpSound, coordinates, user);
|
||||
|
|
@ -72,7 +89,16 @@ public abstract class SharedEmpSystem : EntitySystem
|
|||
}
|
||||
// TODO: replace with PredictedSpawn once it works with animated sprites
|
||||
if (_net.IsServer)
|
||||
Spawn(EmpPulseEffectPrototype, coordinates);
|
||||
{
|
||||
var emp = Spawn(EmpPulseEffectPrototype, coordinates); // Frontier: Added visual effect
|
||||
EnsureComp<EmpBlastComponent>(emp, out var empBlast); // Frontier
|
||||
empBlast.VisualRange = range; // Frontier
|
||||
|
||||
if (range > _cfg.GetCVar(CVars.NetMaxUpdateRange)) // Frontier
|
||||
_pvs.AddGlobalOverride(emp); // Frontier
|
||||
|
||||
Dirty(emp, empBlast); // Frontier
|
||||
}
|
||||
|
||||
_audio.PlayPredicted(EmpSound, coordinates, user);
|
||||
}
|
||||
|
|
@ -170,7 +196,7 @@ public record struct EmpAttemptEvent(bool Cancelled);
|
|||
/// <param name="User">The player that caused the EMP. For prediction purposes.</param>
|
||||
|
||||
[ByRefEvent]
|
||||
public record struct EmpPulseEvent(float EnergyConsumption, bool Affected, bool Disabled, TimeSpan Duration, EntityUid? User);
|
||||
public record struct EmpPulseEvent(float EnergyConsumption, bool Affected, bool Disabled, TimeSpan Duration, EntityUid? User, DamageSpecifier? Damage = null); // DeltaV - Added Damage
|
||||
|
||||
/// <summary>
|
||||
/// Raised on an entity after <see cref="EmpDisabledComponent"/> is removed.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public sealed partial class TechnokineticPulseAbilityComponent : Component
|
|||
/// The duration for which devices are disabled.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public float DisableDuration = 20f;
|
||||
public TimeSpan DisableDuration = TimeSpan.FromSeconds(20f);
|
||||
|
||||
/// <summary>
|
||||
/// The action that triggers the technokinetic pulse ability.
|
||||
|
|
|
|||
Loading…
Reference in New Issue