Xenoartifact: Fix teleport effect (#41049)

* Fix teleport effect

Fix teleport effect, teleporting the artifact instead of the node. Also fix the popup happening twice.

* Detach from parent

* Resolve popup

* fix pulling issue

* Fixed via joint system instead of pulling system

* artifact

* requested changes
This commit is contained in:
TheGrimbeeper
2025-10-26 21:25:18 +11:00
committed by GitHub
parent d553558397
commit 53bb27fef7

View File

@@ -1,7 +1,10 @@
using Content.Shared.Popups;
using Content.Shared.Xenoarchaeology.Artifact.Components;
using Content.Shared.Xenoarchaeology.Artifact.XAE.Components;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Systems;
namespace Content.Shared.Xenoarchaeology.Artifact.XAE;
@@ -11,6 +14,7 @@ public sealed class XAERandomTeleportInvokerSystem : BaseXAESystem<XAERandomTele
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedTransformSystem _xform = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedJointSystem _jointSystem = default!;
/// <inheritdoc />
protected override void OnActivated(Entity<XAERandomTeleportInvokerComponent> ent, ref XenoArtifactNodeActivatedEvent args)
@@ -20,10 +24,13 @@ public sealed class XAERandomTeleportInvokerSystem : BaseXAESystem<XAERandomTele
// todo: teleport person who activated artifact with artifact itself
var component = ent.Comp;
var xform = Transform(ent.Owner);
_popup.PopupCoordinates(Loc.GetString("blink-artifact-popup"), xform.Coordinates, PopupType.Medium);
var xform = Transform(args.Artifact);
_popup.PopupPredictedCoordinates(Loc.GetString("blink-artifact-popup"), xform.Coordinates, args.User, PopupType.Medium);
var offsetTo = _random.NextVector2(component.MinRange, component.MaxRange);
_xform.SetCoordinates(ent.Owner, xform, xform.Coordinates.Offset(offsetTo));
_xform.AttachToGridOrMap(args.Artifact);
_jointSystem.ClearJoints(args.Artifact);
_xform.SetCoordinates(args.Artifact, xform, xform.Coordinates.Offset(offsetTo));
}
}