From b466e22ddfed908e5f8826900234432e71dc2aa0 Mon Sep 17 00:00:00 2001 From: Mnemotechnican <69920617+Mnemotechnician@users.noreply.github.com> Date: Thu, 4 Jan 2024 08:02:27 +0300 Subject: [PATCH] Implemented IFF search (#826) --- Content.Client/Shuttles/UI/RadarControl.cs | 23 ++++++++----------- .../Shuttles/UI/ShuttleConsoleWindow.xaml | 8 +++++++ .../Shuttles/UI/ShuttleConsoleWindow.xaml.cs | 16 +++++++++++++ Resources/Locale/en-US/shuttles/console.ftl | 2 ++ 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/Content.Client/Shuttles/UI/RadarControl.cs b/Content.Client/Shuttles/UI/RadarControl.cs index 151c19eb131..735fdf564e0 100644 --- a/Content.Client/Shuttles/UI/RadarControl.cs +++ b/Content.Client/Shuttles/UI/RadarControl.cs @@ -45,6 +45,11 @@ public sealed class RadarControl : MapGridControl public bool ShowIFFShuttles { get; set; } = true; public bool ShowDocks { get; set; } = true; + /// + /// If present, called for every IFF. Must determine if it should or should not be shown. + /// + public Func? IFFFilter { get; set; } = null; + /// /// Currently hovered docked to show on the map. /// @@ -286,19 +291,11 @@ protected override void Draw(DrawingHandleScreen handle) uiPosition = new Vector2(uiX + uiXCentre, uiY + uiYCentre); } - if (!ShowIFFShuttles) - { - if (iff != null && (iff.Flags & IFFFlags.IsPlayerShuttle) != 0x0) - { - label.Visible = false; - } - else - label.Visible = true; - } - else - { - label.Visible = true; - } + label.Visible = ShowIFFShuttles + || iff == null || (iff.Flags & IFFFlags.IsPlayerShuttle) == 0x0; + + if (IFFFilter != null) + label.Visible &= IFFFilter(gUid, grid.Comp, iff); label.Text = Loc.GetString("shuttle-console-iff-label", ("name", name), ("distance", $"{distance:0.0}")); LayoutContainer.SetPosition(label, uiPosition); diff --git a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml index 653813f909f..2e62fd88f2e 100644 --- a/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml +++ b/Content.Client/Shuttles/UI/ShuttleConsoleWindow.xaml @@ -103,6 +103,7 @@ Align="Right"/> +