Fix duplicate suit signals (#35918)

* Include the suit owner’s UID in suit sensor status updates.

* Show a single monitoring entry per crew member

* Rewrite sensor collection using a dictionary
This commit is contained in:
Ciarán Walsh
2025-04-16 22:14:05 +01:00
committed by GitHub
parent a28a12140e
commit a16097fa33
3 changed files with 28 additions and 5 deletions

View File

@@ -79,10 +79,28 @@ public sealed partial class CrewMonitoringWindow : FancyWindow
NoServerLabel.Visible = false;
// Collect one status per user, using the sensor with the most data available.
Dictionary<NetEntity, SuitSensorStatus> uniqueSensorsMap = new();
foreach (var sensor in sensors)
{
if (uniqueSensorsMap.TryGetValue(sensor.OwnerUid, out var existingSensor))
{
// Skip if we already have a sensor with more data for this mob.
if (existingSensor.Coordinates != null && sensor.Coordinates == null)
continue;
if (existingSensor.DamagePercentage != null && sensor.DamagePercentage == null)
continue;
}
uniqueSensorsMap[sensor.OwnerUid] = sensor;
}
var uniqueSensors = uniqueSensorsMap.Values.ToList();
// Order sensor data
var orderedSensors = sensors.OrderBy(n => n.Name).OrderBy(j => j.Job);
var orderedSensors = uniqueSensors.OrderBy(n => n.Name).OrderBy(j => j.Job);
var assignedSensors = new HashSet<SuitSensorStatus>();
var departments = sensors.SelectMany(d => d.JobDepartments).Distinct().OrderBy(n => n);
var departments = uniqueSensors.SelectMany(d => d.JobDepartments).Distinct().OrderBy(n => n);
// Create department labels and populate lists
foreach (var department in departments)