Two additional checks to prevent FTLing stations (#32558)
Add two additional checks to prevent FTLing
This commit is contained in:
@@ -124,6 +124,9 @@ public sealed partial class ShuttleConsoleSystem
|
|||||||
if (!TryComp(shuttleUid, out ShuttleComponent? shuttleComp))
|
if (!TryComp(shuttleUid, out ShuttleComponent? shuttleComp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (shuttleComp.Enabled == false)
|
||||||
|
return;
|
||||||
|
|
||||||
// Check shuttle can even FTL
|
// Check shuttle can even FTL
|
||||||
if (!_shuttle.CanFTL(shuttleUid.Value, out var reason))
|
if (!_shuttle.CanFTL(shuttleUid.Value, out var reason))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -225,18 +225,28 @@ public sealed partial class ShuttleSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CanFTL(EntityUid shuttleUid, [NotNullWhen(false)] out string? reason)
|
public bool CanFTL(EntityUid shuttleUid, [NotNullWhen(false)] out string? reason)
|
||||||
{
|
{
|
||||||
|
// Currently in FTL already
|
||||||
if (HasComp<FTLComponent>(shuttleUid))
|
if (HasComp<FTLComponent>(shuttleUid))
|
||||||
{
|
{
|
||||||
reason = Loc.GetString("shuttle-console-in-ftl");
|
reason = Loc.GetString("shuttle-console-in-ftl");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FTLMassLimit > 0 &&
|
if (TryComp<PhysicsComponent>(shuttleUid, out var shuttlePhysics))
|
||||||
TryComp(shuttleUid, out PhysicsComponent? shuttlePhysics) &&
|
|
||||||
shuttlePhysics.Mass > FTLMassLimit)
|
|
||||||
{
|
{
|
||||||
reason = Loc.GetString("shuttle-console-mass");
|
// Static physics type is set when station anchor is enabled
|
||||||
return false;
|
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))
|
if (HasComp<PreventPilotComponent>(shuttleUid))
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ shuttle-pilot-end = Stopped piloting
|
|||||||
shuttle-console-in-ftl = Currently in FTL
|
shuttle-console-in-ftl = Currently in FTL
|
||||||
shuttle-console-mass = Too large to FTL
|
shuttle-console-mass = Too large to FTL
|
||||||
shuttle-console-prevent = You are unable to pilot this ship
|
shuttle-console-prevent = You are unable to pilot this ship
|
||||||
|
shuttle-console-static = Grid is static
|
||||||
|
|
||||||
# NAV
|
# NAV
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user