Content update for NetEntities (#18935)

This commit is contained in:
metalgearsloth
2023-09-11 09:42:41 +10:00
committed by GitHub
parent 389c8d1a2c
commit 5a0fc68be2
526 changed files with 3058 additions and 2215 deletions

View File

@@ -495,16 +495,16 @@ namespace Content.Server.NPC.Pathfinding
private DebugPathPoly GetDebugPoly(PathPoly poly)
{
// Create fake neighbors for it
var neighbors = new List<EntityCoordinates>(poly.Neighbors.Count);
var neighbors = new List<NetCoordinates>(poly.Neighbors.Count);
foreach (var neighbor in poly.Neighbors)
{
neighbors.Add(neighbor.Coordinates);
neighbors.Add(GetNetCoordinates(neighbor.Coordinates));
}
return new DebugPathPoly()
{
GraphUid = poly.GraphUid,
GraphUid = GetNetEntity(poly.GraphUid),
ChunkOrigin = poly.ChunkOrigin,
TileIndex = poly.TileIndex,
Box = poly.Box,
@@ -579,12 +579,14 @@ namespace Content.Server.NPC.Pathfinding
foreach (var comp in EntityQuery<GridPathfindingComponent>(true))
{
msg.Breadcrumbs.Add(comp.Owner, new Dictionary<Vector2i, List<PathfindingBreadcrumb>>(comp.Chunks.Count));
var netGrid = GetNetEntity(comp.Owner);
msg.Breadcrumbs.Add(netGrid, new Dictionary<Vector2i, List<PathfindingBreadcrumb>>(comp.Chunks.Count));
foreach (var chunk in comp.Chunks)
{
var data = GetCrumbs(chunk.Value);
msg.Breadcrumbs[comp.Owner].Add(chunk.Key, data);
msg.Breadcrumbs[netGrid].Add(chunk.Key, data);
}
}
@@ -626,12 +628,14 @@ namespace Content.Server.NPC.Pathfinding
foreach (var comp in EntityQuery<GridPathfindingComponent>(true))
{
msg.Polys.Add(comp.Owner, new Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>(comp.Chunks.Count));
var netGrid = GetNetEntity(comp.Owner);
msg.Polys.Add(netGrid, new Dictionary<Vector2i, Dictionary<Vector2i, List<DebugPathPoly>>>(comp.Chunks.Count));
foreach (var chunk in comp.Chunks)
{
var data = GetPolys(chunk.Value);
msg.Polys[comp.Owner].Add(chunk.Key, data);
msg.Polys[netGrid].Add(chunk.Key, data);
}
}
@@ -646,7 +650,7 @@ namespace Content.Server.NPC.Pathfinding
var msg = new PathBreadcrumbsRefreshMessage()
{
Origin = chunk.Origin,
GridUid = gridUid,
GridUid = GetNetEntity(gridUid),
Data = GetCrumbs(chunk),
};
@@ -680,7 +684,7 @@ namespace Content.Server.NPC.Pathfinding
var msg = new PathPolysRefreshMessage()
{
Origin = chunk.Origin,
GridUid = gridUid,
GridUid = GetNetEntity(gridUid),
Polys = data,
};