diff --git a/Content.Server/Salvage/SalvageSystem.Runner.cs b/Content.Server/Salvage/SalvageSystem.Runner.cs index 01f7340d42..9c7cd903bd 100644 --- a/Content.Server/Salvage/SalvageSystem.Runner.cs +++ b/Content.Server/Salvage/SalvageSystem.Runner.cs @@ -5,6 +5,8 @@ using Content.Server.Shuttles.Events; using Content.Server.Shuttles.Systems; using Content.Server.Station.Components; using Content.Shared.Chat; +using Content.Shared.Humanoid; +using Content.Shared.Mobs.Components; using Content.Shared.Salvage; using Content.Shared.Shuttles.Components; using Robust.Shared.Audio; @@ -25,6 +27,33 @@ public sealed partial class SalvageSystem SubscribeLocalEvent(OnFTLRequest); SubscribeLocalEvent(OnFTLStarted); SubscribeLocalEvent(OnFTLCompleted); + SubscribeLocalEvent(OnConsoleFTLAttempt); + } + + private void OnConsoleFTLAttempt(ref ConsoleFTLAttemptEvent ev) + { + if (!TryComp(ev.Uid, out var xform) || + !TryComp(xform.MapUid, out var salvage)) + { + return; + } + + // TODO: This is terrible but need bluespace harnesses or something. + var query = EntityQueryEnumerator(); + + while (query.MoveNext(out var _, out var _, out var mobXform)) + { + if (mobXform.MapUid != xform.MapUid) + continue; + + // Okay they're on salvage, so are they on the shuttle. + if (mobXform.GridUid != ev.Uid) + { + ev.Cancelled = true; + ev.Reason = Loc.GetString("salvage-expedition-not-all-present"); + return; + } + } } /// @@ -74,8 +103,6 @@ public sealed partial class SalvageSystem Announce(args.MapUid, Loc.GetString("salvage-expedition-announcement-dungeon", ("direction", component.DungeonLocation.GetDir()))); component.Stage = ExpeditionStage.Running; - // At least for now stop them FTLing back until the mission is over. - EnsureComp(args.Entity); } private void OnFTLStarted(ref FTLStartedEvent ev) @@ -97,9 +124,6 @@ public sealed partial class SalvageSystem return; } - // Let them pilot again when they get back. - RemCompDeferred(ev.Entity); - // Check if any shuttles remain. var query = EntityQueryEnumerator(); diff --git a/Content.Server/Shuttles/Events/ConsoleFTLAttemptEvent.cs b/Content.Server/Shuttles/Events/ConsoleFTLAttemptEvent.cs new file mode 100644 index 0000000000..ad2b355edb --- /dev/null +++ b/Content.Server/Shuttles/Events/ConsoleFTLAttemptEvent.cs @@ -0,0 +1,9 @@ +namespace Content.Server.Shuttles.Events; + +/// +/// Raised when a shuttle console is trying to FTL via UI input. +/// +/// +/// +[ByRefEvent] +public record struct ConsoleFTLAttemptEvent(EntityUid Uid, bool Cancelled, string Reason); diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index 594be5aa54..2187936551 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -96,6 +96,18 @@ public sealed partial class ShuttleSystem return false; } + if (uid != null) + { + var ev = new ConsoleFTLAttemptEvent(uid.Value, false, string.Empty); + RaiseLocalEvent(uid.Value, ref ev, true); + + if (ev.Cancelled) + { + reason = ev.Reason; + return false; + } + } + reason = null; return true; } diff --git a/Resources/Locale/en-US/procedural/expeditions.ftl b/Resources/Locale/en-US/procedural/expeditions.ftl index b7258d365d..bed82b0fb0 100644 --- a/Resources/Locale/en-US/procedural/expeditions.ftl +++ b/Resources/Locale/en-US/procedural/expeditions.ftl @@ -36,6 +36,8 @@ salvage-expedition-difficulty-Hazardous = Hazardous salvage-expedition-difficulty-Extreme = Extreme # Runner +salvage-expedition-not-all-present = Not all salvagers are aboard the shuttle! + salvage-expedition-announcement-countdown-minutes = {$duration} minutes remaining to complete the expedition. salvage-expedition-announcement-countdown-seconds = {$duration} seconds remaining to complete the expedition. salvage-expedition-announcement-dungeon = Dungeon is located {$direction}.