#1607 deprecate IEntityQuery (#4204)

* #1607 partial progress

* #1607 partial progress

* #1607 almost done

* #1607 PR suggestions

* #1607 PR suggestions

* #1607 PR suggestions

* #1607 PR tweak

* #1607 PR tweak

* #1607 removed unused namespaces

* #1607 PR tweak

* Fix jank

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Galactic Chimp
2021-06-27 05:40:03 +02:00
committed by GitHub
parent 71d939bed5
commit 769daedaa9
10 changed files with 45 additions and 40 deletions

View File

@@ -1,6 +1,7 @@
#nullable enable
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Shared.Administration;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
@@ -45,10 +46,12 @@ namespace Content.Server.Administration.Commands
}
var entityManager = IoCManager.Resolve<IEntityManager>();
var query = new MultipleTypeEntityQuery(components);
var entityIds = new HashSet<string>();
foreach (var entity in entityManager.GetEntities(query))
var entitiesWithComponents = components.Select(c => entityManager.ComponentManager.GetAllComponents(c).Select(x => x.Owner));
var entitiesWithAllComponents = entitiesWithComponents.Skip(1).Aggregate(new HashSet<IEntity>(entitiesWithComponents.First()), (h, e) => { h.IntersectWith(e); return h; });
foreach (var entity in entitiesWithAllComponents)
{
if (entity.Prototype == null)
{