From da0b8d47315a35859cf4b562423d954a6bdbb683 Mon Sep 17 00:00:00 2001 From: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Date: Fri, 9 Aug 2024 07:24:49 +0200 Subject: [PATCH] remove UntrackedMapBoundUserInterface (#30752) --- .../UI/StationMapBoundUserInterface.cs | 6 +++- .../UI/UntrackedMapBoundUserInterface.cs | 28 ------------------- .../Tests/GameRules/NukeOpsTest.cs | 2 +- ...omponent.cs => StationMapUserComponent.cs} | 6 ---- .../Pinpointer/StationMapComponent.cs | 11 ++++++++ .../Prototypes/Entities/Objects/Fun/pai.yml | 2 +- 6 files changed, 18 insertions(+), 37 deletions(-) delete mode 100644 Content.Client/Pinpointer/UI/UntrackedMapBoundUserInterface.cs rename Content.Server/Pinpointer/{StationMapComponent.cs => StationMapUserComponent.cs} (77%) create mode 100644 Content.Shared/Pinpointer/StationMapComponent.cs diff --git a/Content.Client/Pinpointer/UI/StationMapBoundUserInterface.cs b/Content.Client/Pinpointer/UI/StationMapBoundUserInterface.cs index 7417fafede..91fb4ef71b 100644 --- a/Content.Client/Pinpointer/UI/StationMapBoundUserInterface.cs +++ b/Content.Client/Pinpointer/UI/StationMapBoundUserInterface.cs @@ -1,3 +1,4 @@ +using Content.Shared.Pinpointer; using Robust.Client.UserInterface; namespace Content.Client.Pinpointer.UI; @@ -23,6 +24,9 @@ public sealed class StationMapBoundUserInterface : BoundUserInterface _window = this.CreateWindow(); _window.Title = EntMan.GetComponent(Owner).EntityName; - _window.Set(gridUid, Owner); + if (EntMan.TryGetComponent(Owner, out var comp) && comp.ShowLocation) + _window.Set(gridUid, Owner); + else + _window.Set(gridUid, null); } } diff --git a/Content.Client/Pinpointer/UI/UntrackedMapBoundUserInterface.cs b/Content.Client/Pinpointer/UI/UntrackedMapBoundUserInterface.cs deleted file mode 100644 index a3ca6f65da..0000000000 --- a/Content.Client/Pinpointer/UI/UntrackedMapBoundUserInterface.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Robust.Client.UserInterface; - -namespace Content.Client.Pinpointer.UI; - -public sealed class UntrackedStationMapBoundUserInterface : BoundUserInterface -{ - [ViewVariables] - private StationMapWindow? _window; - - public UntrackedStationMapBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) - { - } - - protected override void Open() - { - base.Open(); - EntityUid? gridUid = null; - - // TODO: What this just looks like it's been copy-pasted wholesale from StationMapBoundUserInterface? - if (EntMan.TryGetComponent(Owner, out var xform)) - { - gridUid = xform.GridUid; - } - - _window = this.CreateWindow(); - _window.Set(gridUid, Owner); - } -} diff --git a/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs b/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs index 0ccb5e314b..a4563aa37e 100644 --- a/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs +++ b/Content.IntegrationTests/Tests/GameRules/NukeOpsTest.cs @@ -5,7 +5,6 @@ using Content.Server.GameTicking; using Content.Server.GameTicking.Presets; using Content.Server.GameTicking.Rules.Components; using Content.Server.Mind; -using Content.Server.Pinpointer; using Content.Server.Roles; using Content.Server.RoundEnd; using Content.Server.Shuttles.Components; @@ -18,6 +17,7 @@ using Content.Shared.Hands.Components; using Content.Shared.Inventory; using Content.Shared.NPC.Systems; using Content.Shared.NukeOps; +using Content.Shared.Pinpointer; using Content.Shared.Station.Components; using Robust.Server.GameObjects; using Robust.Shared.GameObjects; diff --git a/Content.Server/Pinpointer/StationMapComponent.cs b/Content.Server/Pinpointer/StationMapUserComponent.cs similarity index 77% rename from Content.Server/Pinpointer/StationMapComponent.cs rename to Content.Server/Pinpointer/StationMapUserComponent.cs index 942ea1aba8..358e26d82e 100644 --- a/Content.Server/Pinpointer/StationMapComponent.cs +++ b/Content.Server/Pinpointer/StationMapUserComponent.cs @@ -1,11 +1,5 @@ namespace Content.Server.Pinpointer; -[RegisterComponent] -public sealed partial class StationMapComponent : Component -{ - -} - /// /// Added to an entity using station map so when its parent changes we reset it. /// diff --git a/Content.Shared/Pinpointer/StationMapComponent.cs b/Content.Shared/Pinpointer/StationMapComponent.cs new file mode 100644 index 0000000000..07cc99605e --- /dev/null +++ b/Content.Shared/Pinpointer/StationMapComponent.cs @@ -0,0 +1,11 @@ +namespace Content.Shared.Pinpointer; + +[RegisterComponent] +public sealed partial class StationMapComponent : Component +{ + /// + /// Whether or not to show the user's location on the map. + /// + [DataField] + public bool ShowLocation = true; +} diff --git a/Resources/Prototypes/Entities/Objects/Fun/pai.yml b/Resources/Prototypes/Entities/Objects/Fun/pai.yml index c12f8a8d00..77f16fcd41 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/pai.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/pai.yml @@ -17,7 +17,7 @@ type: InstrumentBoundUserInterface requireInputValidation: false enum.StationMapUiKey.Key: - type: UntrackedStationMapBoundUserInterface + type: StationMapBoundUserInterface requireInputValidation: false - type: Sprite sprite: Objects/Fun/pai.rsi -- 2.52.0