mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Fix mapgrid rendering (#3722)
This commit is contained in:
@@ -102,7 +102,7 @@ internal partial class MapManager
|
||||
var xformQuery = EntityManager.GetEntityQuery<TransformComponent>();
|
||||
|
||||
return EntityManager.EntityQuery<MapGridComponent>(true)
|
||||
.Where(c => xformQuery.GetComponent(((Component) c).Owner).MapID == mapId)
|
||||
.Where(c => xformQuery.GetComponent(c.Owner).MapID == mapId)
|
||||
.Select(c => c);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,11 @@ internal partial class MapManager
|
||||
if (!_gridTrees.TryGetValue(mapId, out var gridTree))
|
||||
return;
|
||||
|
||||
if (EntityManager.TryGetComponent<MapGridComponent>(GetMapEntityId(mapId), out var grid))
|
||||
{
|
||||
callback(grid);
|
||||
}
|
||||
|
||||
var state = (gridTree, callback);
|
||||
|
||||
gridTree.Query(ref state, static (ref (
|
||||
@@ -37,11 +42,6 @@ internal partial class MapManager
|
||||
tuple.callback(data!);
|
||||
return true;
|
||||
}, worldAABB);
|
||||
|
||||
if (EntityManager.TryGetComponent<MapGridComponent>(GetMapEntityId(mapId), out var grid))
|
||||
{
|
||||
callback(grid);
|
||||
}
|
||||
}
|
||||
|
||||
public void FindGridsIntersectingApprox<TState>(MapId mapId, Box2 worldAABB, ref TState state, GridCallback<TState> callback)
|
||||
@@ -92,6 +92,14 @@ internal partial class MapManager
|
||||
if (!_gridTrees.TryGetValue(mapId, out var gridTree)) return Enumerable.Empty<MapGridComponent>();
|
||||
|
||||
DebugTools.Assert(grids.Count == 0);
|
||||
var offset = 0;
|
||||
|
||||
if (EntityManager.TryGetComponent<MapGridComponent>(GetMapEntityId(mapId), out var mapGrid))
|
||||
{
|
||||
grids.Add(mapGrid);
|
||||
offset = 1;
|
||||
}
|
||||
|
||||
var state = (gridTree, grids);
|
||||
|
||||
gridTree.Query(ref state,
|
||||
@@ -104,7 +112,7 @@ internal partial class MapManager
|
||||
|
||||
if (!approx)
|
||||
{
|
||||
for (var i = grids.Count - 1; i >= 0; i--)
|
||||
for (var i = grids.Count - 1; i >= offset; i--)
|
||||
{
|
||||
var grid = grids[i];
|
||||
|
||||
@@ -144,11 +152,6 @@ internal partial class MapManager
|
||||
}
|
||||
}
|
||||
|
||||
if (EntityManager.TryGetComponent<MapGridComponent>(GetMapEntityId(mapId), out var mapGrid))
|
||||
{
|
||||
grids.Add(mapGrid);
|
||||
}
|
||||
|
||||
return grids;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user