Fix objects tab not showing nents (#23837)

* Fix objects tab not showing nents

* Fix everything
This commit is contained in:
metalgearsloth
2024-01-10 19:30:20 +11:00
committed by GitHub
parent 7cd1ed24a5
commit 1170121532
6 changed files with 66 additions and 26 deletions

View File

@@ -85,7 +85,7 @@ public sealed class StationSystem : EntitySystem
{
if (e.NewStatus == SessionStatus.Connected)
{
RaiseNetworkEvent(new StationsUpdatedEvent(GetNetEntitySet(GetStationsSet())), e.Session);
RaiseNetworkEvent(new StationsUpdatedEvent(GetStationNames()), e.Session);
}
}
@@ -93,7 +93,7 @@ public sealed class StationSystem : EntitySystem
private void OnStationAdd(EntityUid uid, StationDataComponent component, ComponentStartup args)
{
RaiseNetworkEvent(new StationsUpdatedEvent(GetNetEntitySet(GetStationsSet())), Filter.Broadcast());
RaiseNetworkEvent(new StationsUpdatedEvent(GetStationNames()), Filter.Broadcast());
var metaData = MetaData(uid);
RaiseLocalEvent(new StationInitializedEvent(uid));
@@ -108,7 +108,7 @@ public sealed class StationSystem : EntitySystem
RemComp<StationMemberComponent>(grid);
}
RaiseNetworkEvent(new StationsUpdatedEvent(GetNetEntitySet(GetStationsSet())), Filter.Broadcast());
RaiseNetworkEvent(new StationsUpdatedEvent(GetStationNames()), Filter.Broadcast());
}
private void OnPreGameMapLoad(PreGameMapLoad ev)
@@ -468,6 +468,19 @@ public sealed class StationSystem : EntitySystem
return stations;
}
public List<(string Name, NetEntity Entity)> GetStationNames()
{
var stations = GetStationsSet();
var stats = new List<(string Name, NetEntity Station)>();
foreach (var weh in stations)
{
stats.Add((MetaData(weh).EntityName, GetNetEntity(weh)));
}
return stats;
}
/// <summary>
/// Returns the first station that has a grid in a certain map.
/// If the map has no stations, null is returned instead.