Update content for new lookup API (#7363)
This commit is contained in:
@@ -108,30 +108,33 @@ namespace Content.Client.NodeContainer
|
||||
|
||||
// Group visible nodes by grid tiles.
|
||||
var worldAABB = overlayDrawArgs.WorldAABB;
|
||||
_lookup.FastEntitiesIntersecting(map, ref worldAABB, entity =>
|
||||
var xformQuery = _entityManager.GetEntityQuery<TransformComponent>();
|
||||
|
||||
foreach (var grid in _mapManager.FindGridsIntersecting(map, worldAABB))
|
||||
{
|
||||
if (!_system.Entities.TryGetValue(entity, out var nodeData))
|
||||
return;
|
||||
|
||||
var gridId = _entityManager.GetComponent<TransformComponent>(entity).GridID;
|
||||
var grid = _mapManager.GetGrid(gridId);
|
||||
var gridDict = _gridIndex.GetOrNew(gridId);
|
||||
var coords = _entityManager.GetComponent<TransformComponent>(entity).Coordinates;
|
||||
|
||||
// TODO: This probably shouldn't be capable of returning NaN...
|
||||
if (float.IsNaN(coords.Position.X) || float.IsNaN(coords.Position.Y))
|
||||
return;
|
||||
|
||||
var tile = gridDict.GetOrNew(grid.TileIndicesFor(coords));
|
||||
|
||||
foreach (var (group, nodeDatum) in nodeData)
|
||||
foreach (var entity in _lookup.GetEntitiesIntersecting(grid.Index, worldAABB))
|
||||
{
|
||||
if (!_system.Filtered.Contains(group.GroupId))
|
||||
if (!_system.Entities.TryGetValue(entity, out var nodeData))
|
||||
return;
|
||||
|
||||
var gridDict = _gridIndex.GetOrNew(grid.Index);
|
||||
var coords = xformQuery.GetComponent(entity).Coordinates;
|
||||
|
||||
// TODO: This probably shouldn't be capable of returning NaN...
|
||||
if (float.IsNaN(coords.Position.X) || float.IsNaN(coords.Position.Y))
|
||||
return;
|
||||
|
||||
var tile = gridDict.GetOrNew(grid.TileIndicesFor(coords));
|
||||
|
||||
foreach (var (group, nodeDatum) in nodeData)
|
||||
{
|
||||
tile.Add((group, nodeDatum));
|
||||
if (!_system.Filtered.Contains(group.GroupId))
|
||||
{
|
||||
tile.Add((group, nodeDatum));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var (gridId, gridDict) in _gridIndex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user