Files
ss14-wega/Content.Client/Pinpointer/UI/StationMapBoundUserInterface.cs
SlamBamActionman 435b7d5cf8 Add the ability for station maps to track grids they are not on (#41248)
* Initial commit

* Accidentally included the nukie map changes

* Fix the gridcheck

* Addressing review

* Review change

* Review comments
2026-01-12 02:47:47 +00:00

44 lines
1.2 KiB
C#

using Content.Shared.Pinpointer;
using Robust.Client.UserInterface;
namespace Content.Client.Pinpointer.UI;
public sealed class StationMapBoundUserInterface : BoundUserInterface
{
[ViewVariables]
private StationMapWindow? _window;
public StationMapBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
EntityUid? gridUid = null;
if (EntMan.TryGetComponent<StationMapComponent>(Owner, out var comp) && comp.TargetGrid != null)
{
gridUid = comp.TargetGrid;
}
else if (EntMan.TryGetComponent<TransformComponent>(Owner, out var xform))
{
gridUid = xform.GridUid;
}
_window = this.CreateWindow<StationMapWindow>();
_window.Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName;
string stationName = string.Empty;
if(EntMan.TryGetComponent<MetaDataComponent>(gridUid, out var gridMetaData))
{
stationName = gridMetaData.EntityName;
}
if (comp != null && comp.ShowLocation)
_window.Set(stationName, gridUid, Owner);
else
_window.Set(stationName, gridUid, null);
}
}