]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fixing spessman getting teleported inside artifact (#36719)
authorFildrance <fildrance@gmail.com>
Sat, 19 Apr 2025 17:07:23 +0000 (20:07 +0300)
committerGitHub <noreply@github.com>
Sat, 19 Apr 2025 17:07:23 +0000 (13:07 -0400)
* fixing spessman getting teleported inside artifact

* refactor: move XAEPortal comp to server

* refactor: replace Spawn and coord logic with with TrySpawnNextTo

---------

Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
Content.Server/Xenoarchaeology/Artifact/XAE/Components/XAEPortalComponent.cs [moved from Content.Shared/Xenoarchaeology/Artifact/XAE/Components/XAEPortalComponent.cs with 68% similarity]
Content.Server/Xenoarchaeology/Artifact/XAE/XAEPortalSystem.cs [moved from Content.Shared/Xenoarchaeology/Artifact/XAE/XAEPortalSystem.cs with 78% similarity]

similarity index 68%
rename from Content.Shared/Xenoarchaeology/Artifact/XAE/Components/XAEPortalComponent.cs
rename to Content.Server/Xenoarchaeology/Artifact/XAE/Components/XAEPortalComponent.cs
index 2e922bb055f2883e5c749afcfb70ead2abf4552c..bafaf78e7fd03443dd8d45756957e81fc7cef036 100644 (file)
@@ -1,12 +1,11 @@
-using Robust.Shared.GameStates;
 using Robust.Shared.Prototypes;
 
-namespace Content.Shared.Xenoarchaeology.Artifact.XAE.Components;
+namespace Content.Server.Xenoarchaeology.Artifact.XAE.Components;
 
 /// <summary>
 ///     When activated artifact will spawn a pair of portals. First - right in artifact, Second - at random point of station.
 /// </summary>
-[RegisterComponent, Access(typeof(XAEPortalSystem)), NetworkedComponent, AutoGenerateComponentState]
+[RegisterComponent, Access(typeof(XAEPortalSystem))]
 public sealed partial class XAEPortalComponent : Component
 {
     /// <summary>
similarity index 78%
rename from Content.Shared/Xenoarchaeology/Artifact/XAE/XAEPortalSystem.cs
rename to Content.Server/Xenoarchaeology/Artifact/XAE/XAEPortalSystem.cs
index 3d5355b5fd08ec05cde87d5b1642ac321dcf5a14..acc36f0f8d016ab198578b853ea88a0f13e6c8cc 100644 (file)
@@ -1,13 +1,15 @@
+using Content.Server.Xenoarchaeology.Artifact.XAE.Components;
 using Content.Shared.Mind.Components;
 using Content.Shared.Mobs.Components;
 using Content.Shared.Teleportation.Systems;
-using Content.Shared.Xenoarchaeology.Artifact.XAE.Components;
+using Content.Shared.Xenoarchaeology.Artifact;
+using Content.Shared.Xenoarchaeology.Artifact.XAE;
 using Robust.Shared.Collections;
 using Robust.Shared.Containers;
 using Robust.Shared.Random;
 using Robust.Shared.Timing;
 
-namespace Content.Shared.Xenoarchaeology.Artifact.XAE;
+namespace Content.Server.Xenoarchaeology.Artifact.XAE;
 
 /// <summary>
 /// System for xeno artifact effect that creates temporary portal between places on station.
@@ -41,17 +43,16 @@ public sealed class XAEPortalSystem : BaseXAESystem<XAEPortalComponent>
         if (validMinds.Count == 0)
             return;
 
-        var offset = _random.NextVector2(2, 3);
-        var originWithOffset = args.Coordinates.Offset(offset);
-        var firstPortal = Spawn(ent.Comp.PortalProto, originWithOffset);
+        if(!TrySpawnNextTo(ent.Comp.PortalProto, args.Artifact, out var firstPortal))
+            return;
 
         var target = _random.Pick(validMinds);
-
-        var secondPortal = Spawn(ent.Comp.PortalProto, _transform.GetMapCoordinates(target));
+        if(!TrySpawnNextTo(ent.Comp.PortalProto, target, out var secondPortal))
+            return;
 
         // Manual position swapping, because the portal that opens doesn't trigger a collision, and doesn't teleport targets the first time.
-        _transform.SwapPositions(target, ent.Owner);
+        _transform.SwapPositions(target, args.Artifact.Owner);
 
-        _link.TryLink(firstPortal, secondPortal, true);
+        _link.TryLink(firstPortal.Value, secondPortal.Value, true);
     }
 }