diff --git a/Content.Server/Anomaly/AnomalySystem.cs b/Content.Server/Anomaly/AnomalySystem.cs index 69f18e5eeb..102391baff 100644 --- a/Content.Server/Anomaly/AnomalySystem.cs +++ b/Content.Server/Anomaly/AnomalySystem.cs @@ -126,6 +126,9 @@ public sealed partial class AnomalySystem : SharedAnomalySystem if (_random.Prob(anomaly.Comp.Continuity)) SetBehavior(anomaly, GetRandomBehavior()); } + + var ev = new AnomalyAffectedByParticleEvent(anomaly, args.OtherEntity); + RaiseLocalEvent(anomaly, ref ev); } /// diff --git a/Content.Server/Anomaly/Effects/ShuffleParticlesAnomalySystem.cs b/Content.Server/Anomaly/Effects/ShuffleParticlesAnomalySystem.cs index 925c826fb5..2139967691 100644 --- a/Content.Server/Anomaly/Effects/ShuffleParticlesAnomalySystem.cs +++ b/Content.Server/Anomaly/Effects/ShuffleParticlesAnomalySystem.cs @@ -1,9 +1,9 @@ using Content.Server.Anomaly.Components; using Content.Shared.Anomaly.Components; -using Robust.Shared.Physics.Events; using Robust.Shared.Random; namespace Content.Server.Anomaly.Effects; + public sealed class ShuffleParticlesAnomalySystem : EntitySystem { [Dependency] private readonly AnomalySystem _anomaly = default!; @@ -12,19 +12,16 @@ public sealed class ShuffleParticlesAnomalySystem : EntitySystem public override void Initialize() { SubscribeLocalEvent(OnPulse); - SubscribeLocalEvent(OnStartCollide); + SubscribeLocalEvent(OnAffectedByParticle); } - private void OnStartCollide(Entity ent, ref StartCollideEvent args) + private void OnAffectedByParticle(Entity ent, ref AnomalyAffectedByParticleEvent args) { - if (!TryComp(ent, out var anomaly)) - return; - - if (!HasComp(args.OtherEntity)) + if (!TryComp(ent, out var anomalyComp)) return; if (ent.Comp.ShuffleOnParticleHit && _random.Prob(ent.Comp.Prob)) - _anomaly.ShuffleParticlesEffect((ent, anomaly)); + _anomaly.ShuffleParticlesEffect((args.Anomaly, anomalyComp)); } private void OnPulse(Entity ent, ref AnomalyPulseEvent args) diff --git a/Content.Server/Anomaly/Components/AnomalousParticleComponent.cs b/Content.Shared/Anomaly/Components/AnomalousParticleComponent.cs similarity index 95% rename from Content.Server/Anomaly/Components/AnomalousParticleComponent.cs rename to Content.Shared/Anomaly/Components/AnomalousParticleComponent.cs index 5b05522bb9..47c49956c9 100644 --- a/Content.Server/Anomaly/Components/AnomalousParticleComponent.cs +++ b/Content.Shared/Anomaly/Components/AnomalousParticleComponent.cs @@ -1,7 +1,4 @@ -using Content.Shared.Anomaly; -using Content.Shared.Anomaly.Components; - -namespace Content.Server.Anomaly.Components; +namespace Content.Shared.Anomaly.Components; /// /// This is used for projectiles which affect anomalies through colliding with them. diff --git a/Content.Shared/Anomaly/Components/AnomalyComponent.cs b/Content.Shared/Anomaly/Components/AnomalyComponent.cs index fb281ca9a3..47320ece03 100644 --- a/Content.Shared/Anomaly/Components/AnomalyComponent.cs +++ b/Content.Shared/Anomaly/Components/AnomalyComponent.cs @@ -324,3 +324,10 @@ public readonly record struct AnomalyHealthChangedEvent(EntityUid Anomaly, float /// [ByRefEvent] public readonly record struct AnomalyBehaviorChangedEvent(EntityUid Anomaly, ProtoId? Old, ProtoId? New); + +/// +/// Event of anomaly being affected by exotic particle. +/// Is raised when particle collides with artifact. +/// +[ByRefEvent] +public record struct AnomalyAffectedByParticleEvent(EntityUid Anomaly, EntityUid Particle);