diff --git a/Content.Server/Teleportation/HandTeleporterSystem.cs b/Content.Server/Teleportation/HandTeleporterSystem.cs index 5c9baf1854..aa4f7eec82 100644 --- a/Content.Server/Teleportation/HandTeleporterSystem.cs +++ b/Content.Server/Teleportation/HandTeleporterSystem.cs @@ -95,6 +95,10 @@ public sealed class HandTeleporterSystem : EntitySystem var timeout = EnsureComp(user); timeout.EnteredPortal = null; component.FirstPortal = Spawn(component.FirstPortalPrototype, Transform(user).Coordinates); + + if (component.AllowPortalsOnDifferentMaps && TryComp(component.FirstPortal, out var portal)) + portal.CanTeleportToOtherMaps = true; + _adminLogger.Add(LogType.EntitySpawn, LogImpact.High, $"{ToPrettyString(user):player} opened {ToPrettyString(component.FirstPortal.Value)} at {Transform(component.FirstPortal.Value).Coordinates} using {ToPrettyString(uid)}"); _audio.PlayPvs(component.NewPortalSound, uid); } @@ -113,6 +117,10 @@ public sealed class HandTeleporterSystem : EntitySystem var timeout = EnsureComp(user); timeout.EnteredPortal = null; component.SecondPortal = Spawn(component.SecondPortalPrototype, Transform(user).Coordinates); + + if (component.AllowPortalsOnDifferentMaps && TryComp(component.SecondPortal, out var portal)) + portal.CanTeleportToOtherMaps = true; + _adminLogger.Add(LogType.EntitySpawn, LogImpact.High, $"{ToPrettyString(user):player} opened {ToPrettyString(component.SecondPortal.Value)} at {Transform(component.SecondPortal.Value).Coordinates} linked to {ToPrettyString(component.FirstPortal!.Value)} using {ToPrettyString(uid)}"); _link.TryLink(component.FirstPortal!.Value, component.SecondPortal.Value, true); _audio.PlayPvs(component.NewPortalSound, uid); diff --git a/Content.Shared/Teleportation/Components/HandTeleporterComponent.cs b/Content.Shared/Teleportation/Components/HandTeleporterComponent.cs index 6ea29d3fd6..ea1aa492f3 100644 --- a/Content.Shared/Teleportation/Components/HandTeleporterComponent.cs +++ b/Content.Shared/Teleportation/Components/HandTeleporterComponent.cs @@ -21,11 +21,17 @@ public sealed partial class HandTeleporterComponent : Component public EntityUid? SecondPortal = null; /// - /// Portals can't be placed on different grids? + /// Should the portals be able to be placed across grids? /// [DataField] public bool AllowPortalsOnDifferentGrids; + /// + /// Should the portals work across maps? + /// + [DataField] + public bool AllowPortalsOnDifferentMaps; + [DataField("firstPortalPrototype", customTypeSerializer: typeof(PrototypeIdSerializer))] public string FirstPortalPrototype = "PortalRed"; diff --git a/Resources/Prototypes/Entities/Objects/Devices/hand_teleporter.yml b/Resources/Prototypes/Entities/Objects/Devices/hand_teleporter.yml index 192aca65fc..f6e30d1e97 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/hand_teleporter.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/hand_teleporter.yml @@ -28,5 +28,7 @@ - state: icon color: green - type: HandTeleporter + allowPortalsOnDifferentGrids: true + allowPortalsOnDifferentMaps: true firstPortalPrototype: PortalGatewayBlue secondPortalPrototype: PortalGatewayOrange