diff --git a/Content.Server/StationEvents/Components/MassHallucinationsComponent.cs b/Content.Server/StationEvents/Components/MassHallucinationsComponent.cs
deleted file mode 100644
index 99b893cad5..0000000000
--- a/Content.Server/StationEvents/Components/MassHallucinationsComponent.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using Content.Server.StationEvents.Events;
-
-namespace Content.Server.StationEvents.Components;
-
-///
-/// This is used to keep track of hallucinated entities to remove effects when event ends
-///
-[RegisterComponent, Access(typeof(MassHallucinationsRule))]
-public sealed partial class MassHallucinationsComponent : Component
-{
-}
diff --git a/Content.Server/StationEvents/Components/MassHallucinationsRuleComponent.cs b/Content.Server/StationEvents/Components/MassHallucinationsRuleComponent.cs
index 63a1f87251..a5268f97a6 100644
--- a/Content.Server/StationEvents/Components/MassHallucinationsRuleComponent.cs
+++ b/Content.Server/StationEvents/Components/MassHallucinationsRuleComponent.cs
@@ -1,5 +1,6 @@
using Content.Server.StationEvents.Events;
using Robust.Shared.Audio;
+using Robust.Shared.Collections;
namespace Content.Server.StationEvents.Components;
@@ -23,4 +24,7 @@ public sealed partial class MassHallucinationsRuleComponent : Component
[DataField("sounds", required: true)]
public SoundSpecifier Sounds = default!;
+
+ [DataField, ViewVariables(VVAccess.ReadOnly)]
+ public List AffectedEntities = new();
}
diff --git a/Content.Server/StationEvents/Events/MassHallucinationsRule.cs b/Content.Server/StationEvents/Events/MassHallucinationsRule.cs
index bfb7699e9d..b03231b5bc 100644
--- a/Content.Server/StationEvents/Events/MassHallucinationsRule.cs
+++ b/Content.Server/StationEvents/Events/MassHallucinationsRule.cs
@@ -2,9 +2,11 @@ using Content.Server.GameTicking.Rules.Components;
using Content.Server.StationEvents.Components;
using Content.Server.Traits.Assorted;
using Content.Shared.GameTicking.Components;
+using Content.Shared.Humanoid;
using Content.Shared.Mind.Components;
using Content.Shared.Traits.Assorted;
+
namespace Content.Server.StationEvents.Events;
public sealed class MassHallucinationsRule : StationEventSystem
@@ -14,16 +16,17 @@ public sealed class MassHallucinationsRule : StationEventSystem();
- while (query.MoveNext(out var ent, out _))
+
+ var query = EntityQueryEnumerator();
+ while (query.MoveNext(out var ent, out _, out _))
{
- if (!HasComp(ent))
+ if (!EnsureComp(ent, out var paracusia))
{
- EnsureComp(ent);
- var paracusia = EnsureComp(ent);
_paracusia.SetSounds(ent, component.Sounds, paracusia);
_paracusia.SetTime(ent, component.MinTimeBetweenIncidents, component.MaxTimeBetweenIncidents, paracusia);
_paracusia.SetDistance(ent, component.MaxSoundDistance);
+
+ component.AffectedEntities.Add(ent);
}
}
}
@@ -31,10 +34,12 @@ public sealed class MassHallucinationsRule : StationEventSystem();
- while (query.MoveNext(out var ent, out _))
+
+ foreach (var ent in component.AffectedEntities)
{
RemComp(ent);
}
+
+ component.AffectedEntities.Clear();
}
}