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

@@ -406,7 +406,7 @@ public sealed class SuitSensorSystem : EntitySystem
totalDamageThreshold = critThreshold.Value.Int();
// finally, form suit sensor status
var status = new SuitSensorStatus(GetNetEntity(uid), userName, userJob, userJobIcon, userJobDepartments);
var status = new SuitSensorStatus(GetNetEntity(sensor.User.Value), GetNetEntity(uid), userName, userJob, userJobIcon, userJobDepartments);
switch (sensor.Mode)
{
case SuitSensorMode.SensorBinary:
@@ -461,6 +461,7 @@ public sealed class SuitSensorSystem : EntitySystem
[SuitSensorConstants.NET_JOB_DEPARTMENTS] = status.JobDepartments,
[SuitSensorConstants.NET_IS_ALIVE] = status.IsAlive,
[SuitSensorConstants.NET_SUIT_SENSOR_UID] = status.SuitSensorUid,
[SuitSensorConstants.NET_OWNER_UID] = status.OwnerUid,
};
if (status.TotalDamage != null)
@@ -491,13 +492,14 @@ public sealed class SuitSensorSystem : EntitySystem
if (!payload.TryGetValue(SuitSensorConstants.NET_JOB_DEPARTMENTS, out List<string>? jobDepartments)) return null;
if (!payload.TryGetValue(SuitSensorConstants.NET_IS_ALIVE, out bool? isAlive)) return null;
if (!payload.TryGetValue(SuitSensorConstants.NET_SUIT_SENSOR_UID, out NetEntity suitSensorUid)) return null;
if (!payload.TryGetValue(SuitSensorConstants.NET_OWNER_UID, out NetEntity ownerUid)) return null;
// try get total damage and cords (optionals)
payload.TryGetValue(SuitSensorConstants.NET_TOTAL_DAMAGE, out int? totalDamage);
payload.TryGetValue(SuitSensorConstants.NET_TOTAL_DAMAGE_THRESHOLD, out int? totalDamageThreshold);
payload.TryGetValue(SuitSensorConstants.NET_COORDINATES, out NetCoordinates? coords);
var status = new SuitSensorStatus(suitSensorUid, name, job, jobIcon, jobDepartments)
var status = new SuitSensorStatus(ownerUid, suitSensorUid, name, job, jobIcon, jobDepartments)
{
IsAlive = isAlive.Value,
TotalDamage = totalDamage,