Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
metalgearsloth committed Aug 31, 2024
1 parent 8e96788 commit c8e7d7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
7 changes: 4 additions & 3 deletions Robust.Shared/GameObjects/ChunkIterator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ public bool MoveNext()

internal static partial class QueryExtensions
{
internal static ArchChunkIterator ChunkIterator(this in Query query, World world)
internal static ArchChunkIterator ChunkIterator(this Query query, World world)
{
var archetypeEnumerator = new ArchetypeEnumerator(query.Matches);
return new ArchChunkIterator(in archetypeEnumerator);
query.Match();
var enumerator = new ArchetypeEnumerator(query.GetMatches());
return new ArchChunkIterator(in enumerator);
}
}
11 changes: 4 additions & 7 deletions Robust.Shared/GameObjects/EntityManager.Components.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@ public int Count<T>() where T : IComponent
/// <inheritdoc />
public int Count(Type component)
{
var query = new QueryDescription
{
All = new ComponentType[] { component }
};
var query = new QueryDescription([component]);
return _world.CountEntities(in query);
}

Expand Down Expand Up @@ -1290,17 +1287,17 @@ public IEnumerable<T> EntityQuery<T>(bool includePaused = false) where T : IComp
/// <inheritdoc />
public IEnumerable<(EntityUid Uid, IComponent Component)> GetAllComponents(Type type, bool includePaused = false)
{
var query = new QueryDescription();
QueryDescription query;

// TODO arch paused component
if (includePaused)
{
// TODO arch pool
query.All = new ComponentType[] { type };
query = new (new ComponentType[] { type });
}
else
{
query.All = new ComponentType[] { type, typeof(MetaDataComponent) };
query = new(new ComponentType[] { type, typeof(MetaDataComponent) });
}

foreach (var chunk in _world.Query(query).ChunkIterator(_world))
Expand Down

0 comments on commit c8e7d7d

Please sign in to comment.