From 295e63193c91124160458cfd14165d644382b23f Mon Sep 17 00:00:00 2001 From: Plykiya <58439124+Plykiya@users.noreply.github.com> Date: Thu, 3 Oct 2024 19:55:36 -0700 Subject: [PATCH] Two additional checks to prevent FTLing stations (#32558) Add two additional checks to prevent FTLing --- .../Systems/ShuttleConsoleSystem.FTL.cs | 3 +++ .../Systems/ShuttleSystem.FasterThanLight.cs | 20 ++++++++++++++----- Resources/Locale/en-US/shuttles/console.ftl | 1 + 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.FTL.cs b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.FTL.cs index 02b1524292..eac2535e8b 100644 --- a/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.FTL.cs +++ b/Content.Server/Shuttles/Systems/ShuttleConsoleSystem.FTL.cs @@ -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)) { diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index ce6a914847..d0aab9aad5 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -225,18 +225,28 @@ public sealed partial class ShuttleSystem /// public bool CanFTL(EntityUid shuttleUid, [NotNullWhen(false)] out string? reason) { + // Currently in FTL already if (HasComp(shuttleUid)) { reason = Loc.GetString("shuttle-console-in-ftl"); return false; } - if (FTLMassLimit > 0 && - TryComp(shuttleUid, out PhysicsComponent? shuttlePhysics) && - shuttlePhysics.Mass > FTLMassLimit) + if (TryComp(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(shuttleUid)) diff --git a/Resources/Locale/en-US/shuttles/console.ftl b/Resources/Locale/en-US/shuttles/console.ftl index 80e61a2812..6143c99552 100644 --- a/Resources/Locale/en-US/shuttles/console.ftl +++ b/Resources/Locale/en-US/shuttles/console.ftl @@ -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