]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix admeme hand teleproter. (#36147)
authorScarKy0 <106310278+ScarKy0@users.noreply.github.com>
Sat, 29 Mar 2025 14:51:46 +0000 (15:51 +0100)
committerGitHub <noreply@github.com>
Sat, 29 Mar 2025 14:51:46 +0000 (17:51 +0300)
* init

* changes

Content.Server/Teleportation/HandTeleporterSystem.cs
Content.Shared/Teleportation/Components/HandTeleporterComponent.cs
Resources/Prototypes/Entities/Objects/Devices/hand_teleporter.yml

index 5c9baf18546e5104bd9be9a467d32a472e0359b8..aa4f7eec822c44728c2b276d79f64868ea643320 100644 (file)
@@ -95,6 +95,10 @@ public sealed class HandTeleporterSystem : EntitySystem
             var timeout = EnsureComp<PortalTimeoutComponent>(user);
             timeout.EnteredPortal = null;
             component.FirstPortal = Spawn(component.FirstPortalPrototype, Transform(user).Coordinates);
+
+            if (component.AllowPortalsOnDifferentMaps && TryComp<PortalComponent>(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<PortalTimeoutComponent>(user);
             timeout.EnteredPortal = null;
             component.SecondPortal = Spawn(component.SecondPortalPrototype, Transform(user).Coordinates);
+
+            if (component.AllowPortalsOnDifferentMaps && TryComp<PortalComponent>(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);
index 6ea29d3fd6ad5c5e8cd18f4e1c84089a21aaf18d..ea1aa492f340772d275a92fbf179608167f63264 100644 (file)
@@ -21,11 +21,17 @@ public sealed partial class HandTeleporterComponent : Component
     public EntityUid? SecondPortal = null;
 
     /// <summary>
-    ///     Portals can't be placed on different grids?
+    ///     Should the portals be able to be placed across grids?
     /// </summary>
     [DataField]
     public bool AllowPortalsOnDifferentGrids;
 
+    /// <summary>
+    ///     Should the portals work across maps?
+    /// </summary>
+    [DataField]
+    public bool AllowPortalsOnDifferentMaps;
+
     [DataField("firstPortalPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
     public string FirstPortalPrototype = "PortalRed";
 
index 192aca65fc6cc0a65704826b231092e904364d1c..f6e30d1e974f13d6fcb28e439f6f41f92c49d335 100644 (file)
@@ -28,5 +28,7 @@
     - state: icon
       color: green
   - type: HandTeleporter
+    allowPortalsOnDifferentGrids: true
+    allowPortalsOnDifferentMaps: true
     firstPortalPrototype: PortalGatewayBlue
     secondPortalPrototype: PortalGatewayOrange