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)
This commit is contained in:
Charlie Morley
2025-11-26 21:50:10 -06:00
committed by GitHub
parent f2b4a62408
commit 4efde19136
@@ -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<ArtifactMetapsionicTriggerComponent>
{
[Dependency] private readonly XenoArtifactSystem _artifact = default!;
private EntityQuery<XenoArtifactComponent> _xenoArtifactQuery;
public override void Initialize()
{
base.Initialize();
_xenoArtifactQuery = GetEntityQuery<XenoArtifactComponent>();
SubscribeLocalEvent<ArtifactMetapsionicTriggerComponent, PsionicPowerDetectedEvent>(OnPowerDetected);
SubscribeLocalEvent<GlimmerEventEndedEvent>(OnGlimmerEventEnded);
@@ -21,37 +26,34 @@ public sealed class ArtifactMetapsionicTriggerSystem : EntitySystem
private void OnPowerDetected(Entity<ArtifactMetapsionicTriggerComponent> ent, ref PsionicPowerDetectedEvent args)
{
if (!TryComp<XenoArtifactComponent>(ent, out var artifactComp))
if (!TryComp<XenoArtifactNodeComponent>(ent, out var node))
return;
var artifactEntity = new Entity<XenoArtifactComponent>(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<ArtifactMetapsionicTriggerComponent>();
while (query.MoveNext(out var uid, out _))
var query = EntityQueryEnumerator<ArtifactMetapsionicTriggerComponent, XenoArtifactNodeComponent>();
while (query.MoveNext(out var uid, out var comp, out var node))
{
if (!TryComp<XenoArtifactComponent>(uid, out var artifactComp))
if (node.Attached == null)
continue;
var artifactEntity = new Entity<XenoArtifactComponent>(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));
}
}
}