From: Fildrance Date: Sat, 19 Apr 2025 17:07:23 +0000 (+0300) Subject: fixing spessman getting teleported inside artifact (#36719) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=b36169c58fff2dd19e23323e5cb6e058fde662db;p=space-station-14.git fixing spessman getting teleported inside artifact (#36719) * 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 --- diff --git a/Content.Shared/Xenoarchaeology/Artifact/XAE/Components/XAEPortalComponent.cs b/Content.Server/Xenoarchaeology/Artifact/XAE/Components/XAEPortalComponent.cs similarity index 68% rename from Content.Shared/Xenoarchaeology/Artifact/XAE/Components/XAEPortalComponent.cs rename to Content.Server/Xenoarchaeology/Artifact/XAE/Components/XAEPortalComponent.cs index 2e922bb055..bafaf78e7f 100644 --- a/Content.Shared/Xenoarchaeology/Artifact/XAE/Components/XAEPortalComponent.cs +++ b/Content.Server/Xenoarchaeology/Artifact/XAE/Components/XAEPortalComponent.cs @@ -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; /// /// When activated artifact will spawn a pair of portals. First - right in artifact, Second - at random point of station. /// -[RegisterComponent, Access(typeof(XAEPortalSystem)), NetworkedComponent, AutoGenerateComponentState] +[RegisterComponent, Access(typeof(XAEPortalSystem))] public sealed partial class XAEPortalComponent : Component { /// diff --git a/Content.Shared/Xenoarchaeology/Artifact/XAE/XAEPortalSystem.cs b/Content.Server/Xenoarchaeology/Artifact/XAE/XAEPortalSystem.cs similarity index 78% rename from Content.Shared/Xenoarchaeology/Artifact/XAE/XAEPortalSystem.cs rename to Content.Server/Xenoarchaeology/Artifact/XAE/XAEPortalSystem.cs index 3d5355b5fd..acc36f0f8d 100644 --- a/Content.Shared/Xenoarchaeology/Artifact/XAE/XAEPortalSystem.cs +++ b/Content.Server/Xenoarchaeology/Artifact/XAE/XAEPortalSystem.cs @@ -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; /// /// System for xeno artifact effect that creates temporary portal between places on station. @@ -41,17 +43,16 @@ public sealed class XAEPortalSystem : BaseXAESystem 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); } }