using Content.Client.Pinpointer.UI; using Robust.Client.Graphics; using Robust.Client.UserInterface.Controls; using Robust.Shared.Timing; namespace Content.Client.Medical.CrewMonitoring; public sealed partial class CrewMonitoringNavMapControl : NavMapControl { [Dependency] private readonly IEntitySystemManager _entitySystem = default!; private readonly SharedTransformSystem _transform = default!; // Frontier public NetEntity? Focus; public Dictionary LocalizedNames = new(); private Label _trackedEntityLabel; private PanelContainer _trackedEntityPanel; public CrewMonitoringNavMapControl() : base() { IoCManager.InjectDependencies(this); // Frontier _transform = _entitySystem.GetEntitySystem(); // Frontier WallColor = new Color(192, 122, 196); TileColor = new(71, 42, 72); BackgroundColor = Color.FromSrgb(TileColor.WithAlpha(BackgroundOpacity)); _trackedEntityLabel = new Label { Margin = new Thickness(10f, 8f), HorizontalAlignment = HAlignment.Center, VerticalAlignment = VAlignment.Center, Modulate = Color.White, }; _trackedEntityPanel = new PanelContainer { PanelOverride = new StyleBoxFlat { BackgroundColor = BackgroundColor, }, Margin = new Thickness(5f, 10f), HorizontalAlignment = HAlignment.Left, VerticalAlignment = VAlignment.Bottom, Visible = false, }; _trackedEntityPanel.AddChild(_trackedEntityLabel); this.AddChild(_trackedEntityPanel); } protected override void FrameUpdate(FrameEventArgs args) { base.FrameUpdate(args); if (Focus == null) { _trackedEntityLabel.Text = string.Empty; _trackedEntityPanel.Visible = false; return; } foreach ((var netEntity, var blip) in TrackedEntities) { if (netEntity != Focus) continue; if (!LocalizedNames.TryGetValue(netEntity, out var name)) name = "Unknown"; // Text location of the blip will display GPS coordinates for the purpose of being able to find a person via GPS // Previously it displayed coordinates relative to the center of the station, which had no use. var mapCoords = _transform.ToMapCoordinates(blip.Coordinates); // Frontier var message = name + "\nLocation: [x = " + MathF.Round(mapCoords.X) + ", y = " + MathF.Round(mapCoords.Y) + "]"; // Frontier: use map coords _trackedEntityLabel.Text = message; _trackedEntityPanel.Visible = true; return; } _trackedEntityLabel.Text = string.Empty; _trackedEntityPanel.Visible = false; } }