Remove 700 usages of Component.Owner (#21100)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System.Linq;
|
||||
using Content.Client.Station;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
@@ -40,13 +39,34 @@ public sealed partial class ObjectsTab : Control
|
||||
|
||||
private void RefreshObjectList(ObjectsTabSelection selection)
|
||||
{
|
||||
var entities = selection switch
|
||||
var entities = new List<EntityUid>();
|
||||
switch (selection)
|
||||
{
|
||||
ObjectsTabSelection.Stations => _entityManager.EntitySysManager.GetEntitySystem<StationSystem>().Stations.ToList(),
|
||||
ObjectsTabSelection.Grids => _entityManager.EntityQuery<MapGridComponent>(true).Select(x => x.Owner).ToList(),
|
||||
ObjectsTabSelection.Maps => _entityManager.EntityQuery<MapComponent>(true).Select(x => x.Owner).ToList(),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(selection), selection, null),
|
||||
};
|
||||
case ObjectsTabSelection.Stations:
|
||||
entities.AddRange(_entityManager.EntitySysManager.GetEntitySystem<StationSystem>().Stations);
|
||||
break;
|
||||
case ObjectsTabSelection.Grids:
|
||||
{
|
||||
var query = _entityManager.AllEntityQueryEnumerator<MapGridComponent>();
|
||||
while (query.MoveNext(out var uid, out _))
|
||||
{
|
||||
entities.Add(uid);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ObjectsTabSelection.Maps:
|
||||
{
|
||||
var query = _entityManager.AllEntityQueryEnumerator<MapComponent>();
|
||||
while (query.MoveNext(out var uid, out _))
|
||||
{
|
||||
entities.Add(uid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(selection), selection, null);
|
||||
}
|
||||
|
||||
foreach (var control in _objects)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user