]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Xenoartifact: Fix teleport effect (#41049)
authorTheGrimbeeper <thegrimbeeper.11@gmail.com>
Sun, 26 Oct 2025 10:25:18 +0000 (21:25 +1100)
committerGitHub <noreply@github.com>
Sun, 26 Oct 2025 10:25:18 +0000 (10:25 +0000)
* 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

Content.Shared/Xenoarchaeology/Artifact/XAE/XAERandomTeleportInvokerSystem.cs

index 24563cbff781eb0a32ecbfcad89326f9fcb33e90..462d44cac082df582ea4ba45cf0ff8c3d4426fcd 100644 (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));
     }
 }