]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix anomaly shuffle particles type (#40624)
authorkosticia <kosticia46@gmail.com>
Thu, 2 Oct 2025 20:00:39 +0000 (23:00 +0300)
committerGitHub <noreply@github.com>
Thu, 2 Oct 2025 20:00:39 +0000 (20:00 +0000)
* dev it

* screw it

* Revert "screw it"

This reverts commit 5657a1d20128e630bebbaf38f4dcb4dbac28d026.

* Revert "dev it"

This reverts commit f3d7c355da17de92e43c145efbd348f8378d6146.

* slarti best

* Revert "slarti best"

This reverts commit 8de1caafb254515202aa21d2b96029a1fce24df2.

* Reapply "dev it"

This reverts commit c603940a73246f8a22a171c5559eb3f3f995e7bc.

* Reapply "screw it"

This reverts commit 468722abe7bde7e30bc3b421bc28fa90a013bd63.

* refactor: renaming +xml-doc

---------

Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
Content.Server/Anomaly/AnomalySystem.cs
Content.Server/Anomaly/Effects/ShuffleParticlesAnomalySystem.cs
Content.Shared/Anomaly/Components/AnomalousParticleComponent.cs [moved from Content.Server/Anomaly/Components/AnomalousParticleComponent.cs with 95% similarity]
Content.Shared/Anomaly/Components/AnomalyComponent.cs

index 69f18e5eeb021766075737e90f0af1f827894d28..102391baffd126b60e9b7c2fea0a3b42207dc0d7 100644 (file)
@@ -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);
     }
 
     /// <summary>
index 925c826fb5a80b31aaef60b8a639b9f702d7b302..21399676915baffa8d55442431b1ab59d4e1d26f 100644 (file)
@@ -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<ShuffleParticlesAnomalyComponent, AnomalyPulseEvent>(OnPulse);
-        SubscribeLocalEvent<ShuffleParticlesAnomalyComponent, StartCollideEvent>(OnStartCollide);
+        SubscribeLocalEvent<ShuffleParticlesAnomalyComponent, AnomalyAffectedByParticleEvent>(OnAffectedByParticle);
     }
 
-    private void OnStartCollide(Entity<ShuffleParticlesAnomalyComponent> ent, ref StartCollideEvent args)
+    private void OnAffectedByParticle(Entity<ShuffleParticlesAnomalyComponent> ent, ref AnomalyAffectedByParticleEvent args)
     {
-        if (!TryComp<AnomalyComponent>(ent, out var anomaly))
-            return;
-
-        if (!HasComp<AnomalousParticleComponent>(args.OtherEntity))
+        if (!TryComp<AnomalyComponent>(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<ShuffleParticlesAnomalyComponent> ent, ref AnomalyPulseEvent args)
similarity index 95%
rename from Content.Server/Anomaly/Components/AnomalousParticleComponent.cs
rename to Content.Shared/Anomaly/Components/AnomalousParticleComponent.cs
index 5b05522bb9abd3ba679e190804ffbcbaa6f4a91b..47c49956c99265102628ee69d98862bc403cfd53 100644 (file)
@@ -1,7 +1,4 @@
-using Content.Shared.Anomaly;
-using Content.Shared.Anomaly.Components;
-
-namespace Content.Server.Anomaly.Components;
+namespace Content.Shared.Anomaly.Components;
 
 /// <summary>
 /// This is used for projectiles which affect anomalies through colliding with them.
index fb281ca9a33614fa13b150a61b3b14846e92f27f..47320ece03dc16d970a68c69a381458b7d720d35 100644 (file)
@@ -324,3 +324,10 @@ public readonly record struct AnomalyHealthChangedEvent(EntityUid Anomaly, float
 /// </summary>
 [ByRefEvent]
 public readonly record struct AnomalyBehaviorChangedEvent(EntityUid Anomaly, ProtoId<AnomalyBehaviorPrototype>? Old, ProtoId<AnomalyBehaviorPrototype>? New);
+
+/// <summary>
+/// Event of anomaly being affected by exotic particle.
+/// Is raised when particle collides with artifact.
+/// </summary>
+[ByRefEvent]
+public record struct AnomalyAffectedByParticleEvent(EntityUid Anomaly, EntityUid Particle);