From 4efde19136f0bfd8a78fdf8f5b3e816f2e77f8df Mon Sep 17 00:00:00 2001 From: Charlie Morley Date: Wed, 26 Nov 2025 20:50:10 -0700 Subject: [PATCH] fix "psionic disturbance" arti trigger not working at all (technical issues related to component) (#4705) fix "psionic disturbance" trigger technical issues (assumed comp was on arti ent, not on node ent) --- .../ArtifactMetapsionicTriggerSystem.cs | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/Content.Server/_DV/Xenoarchaeology/XenoArtifacts/Triggers/Systems/ArtifactMetapsionicTriggerSystem.cs b/Content.Server/_DV/Xenoarchaeology/XenoArtifacts/Triggers/Systems/ArtifactMetapsionicTriggerSystem.cs index 2459ae548e5..83a8bd74367 100644 --- a/Content.Server/_DV/Xenoarchaeology/XenoArtifacts/Triggers/Systems/ArtifactMetapsionicTriggerSystem.cs +++ b/Content.Server/_DV/Xenoarchaeology/XenoArtifacts/Triggers/Systems/ArtifactMetapsionicTriggerSystem.cs @@ -3,17 +3,22 @@ using Content.Server._DV.Xenoarchaeology.XenoArtifacts.Triggers.Components; using Content.Server.Xenoarchaeology.Artifact; using Content.Shared.Abilities.Psionics; using Content.Shared.Xenoarchaeology.Artifact.Components; +using Content.Shared.Xenoarchaeology.Artifact.XAT; namespace Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Systems; -public sealed class ArtifactMetapsionicTriggerSystem : EntitySystem +public sealed class ArtifactMetapsionicTriggerSystem : BaseXATSystem { [Dependency] private readonly XenoArtifactSystem _artifact = default!; + private EntityQuery _xenoArtifactQuery; + public override void Initialize() { base.Initialize(); + _xenoArtifactQuery = GetEntityQuery(); + SubscribeLocalEvent(OnPowerDetected); SubscribeLocalEvent(OnGlimmerEventEnded); @@ -21,37 +26,34 @@ public sealed class ArtifactMetapsionicTriggerSystem : EntitySystem private void OnPowerDetected(Entity ent, ref PsionicPowerDetectedEvent args) { - if (!TryComp(ent, out var artifactComp)) + if (!TryComp(ent, out var node)) return; - var artifactEntity = new Entity(ent, artifactComp); - var coords = Transform(ent).Coordinates; + if (node.Attached == null) + return; - _artifact.TryActivateXenoArtifact( - artifactEntity, - user: null, - target: null, - coordinates: coords - ); + var artifact = _xenoArtifactQuery.Get(GetEntity(node.Attached.Value)); + + if (!CanTrigger(artifact, (ent.Owner, node))) + return; + + Trigger(artifact, (ent.Owner, ent.Comp, node)); } private void OnGlimmerEventEnded(GlimmerEventEndedEvent args) { - var query = EntityQueryEnumerator(); - while (query.MoveNext(out var uid, out _)) + var query = EntityQueryEnumerator(); + while (query.MoveNext(out var uid, out var comp, out var node)) { - if (!TryComp(uid, out var artifactComp)) + if (node.Attached == null) continue; - var artifactEntity = new Entity(uid, artifactComp); - var coords = Transform(uid).Coordinates; + var artifact = _xenoArtifactQuery.Get(GetEntity(node.Attached.Value)); - _artifact.TryActivateXenoArtifact( - artifactEntity, - user: null, - target: null, - coordinates: coords - ); + if (!CanTrigger(artifact, (uid, node))) + continue; + + Trigger(artifact, (uid, comp, node)); } } }