diff --git a/Content.Server/Pinpointer/ServerPinpointerSystem.cs b/Content.Server/Pinpointer/ServerPinpointerSystem.cs index 21f4405059..a785ab83d9 100644 --- a/Content.Server/Pinpointer/ServerPinpointerSystem.cs +++ b/Content.Server/Pinpointer/ServerPinpointerSystem.cs @@ -2,6 +2,7 @@ using Content.Shared.Interaction; using Content.Shared.Pinpointer; using System.Linq; using Robust.Shared.Utility; +using Content.Server.Shuttles.Events; namespace Content.Server.Pinpointer { @@ -13,12 +14,29 @@ namespace Content.Server.Pinpointer { base.Initialize(); SubscribeLocalEvent(OnActivate); + SubscribeLocalEvent(OnLocateTarget); } private void OnActivate(EntityUid uid, PinpointerComponent component, ActivateInWorldEvent args) { TogglePinpointer(uid, component); + LocateTarget(uid, component); + } + private void OnLocateTarget(HyperspaceJumpCompletedEvent ev) + { + // This feels kind of expensive, but it only happens once per hyperspace jump + foreach (var uid in ActivePinpointers) + { + if (TryComp(uid, out var component)) + { + LocateTarget(uid, component); + } + } + } + + private void LocateTarget(EntityUid uid, PinpointerComponent component) + { // try to find target from whitelist if (component.IsActive && component.Component != null) { diff --git a/Content.Server/Shuttles/Events/HyperspaceJumpCompletedEvent.cs b/Content.Server/Shuttles/Events/HyperspaceJumpCompletedEvent.cs new file mode 100644 index 0000000000..4041d3e01c --- /dev/null +++ b/Content.Server/Shuttles/Events/HyperspaceJumpCompletedEvent.cs @@ -0,0 +1,8 @@ +using Content.Server.Shuttles.Systems; + +namespace Content.Server.Shuttles.Events; + +/// +/// Raised when has completed FTL Travel. +/// +public sealed class HyperspaceJumpCompletedEvent: EntityEventArgs {} diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index a6e4709952..ea08d1ba4c 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -13,6 +13,7 @@ using Robust.Shared.Map; using Robust.Shared.Player; using Robust.Shared.Utility; using System.Diagnostics.CodeAnalysis; +using Content.Server.Shuttles.Events; namespace Content.Server.Shuttles.Systems; @@ -307,6 +308,7 @@ public sealed partial class ShuttleSystem comp.State = FTLState.Cooldown; comp.Accumulator += FTLCooldown; _console.RefreshShuttleConsoles(comp.Owner); + RaiseLocalEvent(new HyperspaceJumpCompletedEvent()); break; case FTLState.Cooldown: RemComp(comp.Owner);