From 24cc28b53226b0690eb97ef4b71a29abe42ef190 Mon Sep 17 00:00:00 2001 From: Elperson <40611324+Elpersonn@users.noreply.github.com> Date: Sun, 31 Aug 2025 19:31:38 +0200 Subject: [PATCH] Actually make LPO's crew monitor actually show people on the station (#4273) * Simple fix * maintainer requested changes --- .../CrewMonitoringBoundUserInterface.cs | 2 +- .../LongRangeCrewMonitorSystem.cs | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Content.Client/Medical/CrewMonitoring/CrewMonitoringBoundUserInterface.cs b/Content.Client/Medical/CrewMonitoring/CrewMonitoringBoundUserInterface.cs index 533a867c00..42c8c45d50 100644 --- a/Content.Client/Medical/CrewMonitoring/CrewMonitoringBoundUserInterface.cs +++ b/Content.Client/Medical/CrewMonitoring/CrewMonitoringBoundUserInterface.cs @@ -26,7 +26,7 @@ public sealed class CrewMonitoringBoundUserInterface : BoundUserInterface // Begin DeltaV Additions - Find a station's grid instead of the current one for evil monitors if (EntMan.HasComponent(Owner)) { - gridUid = EntMan.System().FindStationGridInMap(xform.MapID); + gridUid = EntMan.System().FindLargestStationGridInMap(xform.MapID); gridUid ??= xform.GridUid; // fall back to whatever grid this is on if it failed } // End DeltaV Additions diff --git a/Content.Shared/_DV/Medical/CrewMonitoring/LongRangeCrewMonitorSystem.cs b/Content.Shared/_DV/Medical/CrewMonitoring/LongRangeCrewMonitorSystem.cs index 32a0e85436..01ac6916fc 100644 --- a/Content.Shared/_DV/Medical/CrewMonitoring/LongRangeCrewMonitorSystem.cs +++ b/Content.Shared/_DV/Medical/CrewMonitoring/LongRangeCrewMonitorSystem.cs @@ -7,19 +7,20 @@ namespace Content.Shared._DV.Medical.CrewMonitoring; public sealed class LongRangeCrewMonitorSystem : EntitySystem { /// - /// Finds an arbitrary station grid on the same map as the argument. - /// Returns null if no grid was found. + /// Finds the largest (presumably the main station) grid on the same map as the argument. /// - public EntityUid? FindStationGridInMap(MapId map) + /// + /// Returns null if not found + public EntityUid? FindLargestStationGridInMap(MapId map) { // also requiring MapGrid incase StationMember gets used for non-grids in the future + (EntityUid?, int) biggest_grid = (null, 0); var query = EntityQueryEnumerator(); - while (query.MoveNext(out var grid, out _, out _)) + while (query.MoveNext(out var grid, out _, out var mapgrid)) { - if (Transform(grid).MapID == map) - return grid; + if (Transform(grid).MapID == map && mapgrid.ChunkCount > biggest_grid.Item2) + biggest_grid = (grid, mapgrid.ChunkCount); } - - return null; + return biggest_grid.Item1; } }