-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>
+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.
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);
}
}