]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Two additional checks to prevent FTLing stations (#32558)
authorPlykiya <58439124+Plykiya@users.noreply.github.com>
Fri, 4 Oct 2024 02:55:36 +0000 (19:55 -0700)
committerGitHub <noreply@github.com>
Fri, 4 Oct 2024 02:55:36 +0000 (12:55 +1000)
Add two additional checks to prevent FTLing

Content.Server/Shuttles/Systems/ShuttleConsoleSystem.FTL.cs
Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs
Resources/Locale/en-US/shuttles/console.ftl

index 02b152429238bb25b03077e10bcbf86d84d5b830..eac2535e8b253805c3b9c7e61982468dbfe7319d 100644 (file)
@@ -124,6 +124,9 @@ public sealed partial class ShuttleConsoleSystem
         if (!TryComp(shuttleUid, out ShuttleComponent? shuttleComp))
             return;
 
+        if (shuttleComp.Enabled == false)
+            return;
+
         // Check shuttle can even FTL
         if (!_shuttle.CanFTL(shuttleUid.Value, out var reason))
         {
index ce6a914847f93db17e1f2d4ff4ec9ac78363ef2b..d0aab9aad559b84d3e4a797b903fe72fb0f78752 100644 (file)
@@ -225,18 +225,28 @@ public sealed partial class ShuttleSystem
     /// </summary>
     public bool CanFTL(EntityUid shuttleUid, [NotNullWhen(false)] out string? reason)
     {
+        // Currently in FTL already
         if (HasComp<FTLComponent>(shuttleUid))
         {
             reason = Loc.GetString("shuttle-console-in-ftl");
             return false;
         }
 
-        if (FTLMassLimit > 0 &&
-            TryComp(shuttleUid, out PhysicsComponent? shuttlePhysics) &&
-            shuttlePhysics.Mass > FTLMassLimit)
+        if (TryComp<PhysicsComponent>(shuttleUid, out var shuttlePhysics))
         {
-            reason = Loc.GetString("shuttle-console-mass");
-            return false;
+            // Static physics type is set when station anchor is enabled
+            if (shuttlePhysics.BodyType == BodyType.Static)
+            {
+                reason = Loc.GetString("shuttle-console-static");
+                return false;
+            }
+
+            // Too large to FTL
+            if (FTLMassLimit > 0 &&  shuttlePhysics.Mass > FTLMassLimit)
+            {
+                reason = Loc.GetString("shuttle-console-mass");
+                return false;
+            }
         }
 
         if (HasComp<PreventPilotComponent>(shuttleUid))
index 80e61a281266db817e6cb51c2b7aacdc2caefbb7..6143c9955296481b5f0c51a82b64b88947e28aea 100644 (file)
@@ -4,6 +4,7 @@ shuttle-pilot-end = Stopped piloting
 shuttle-console-in-ftl = Currently in FTL
 shuttle-console-mass = Too large to FTL
 shuttle-console-prevent = You are unable to pilot this ship
+shuttle-console-static = Grid is static
 
 # NAV