From 8b177e83e5752ec1e8f2007c9246f1f3c5aea204 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 19 Dec 2022 13:11:09 +1100 Subject: [PATCH] Add VV to gridpathfinding comp (#13081) --- Content.Server/NPC/Pathfinding/GridPathfindingChunk.cs | 5 +++++ Content.Server/NPC/Pathfinding/GridPathfindingComponent.cs | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/Content.Server/NPC/Pathfinding/GridPathfindingChunk.cs b/Content.Server/NPC/Pathfinding/GridPathfindingChunk.cs index 71b82c9f7a..d3377cb071 100644 --- a/Content.Server/NPC/Pathfinding/GridPathfindingChunk.cs +++ b/Content.Server/NPC/Pathfinding/GridPathfindingChunk.cs @@ -5,12 +5,15 @@ namespace Content.Server.NPC.Pathfinding; public sealed class GridPathfindingChunk { // TODO: Make this a 1d array + [ViewVariables] public readonly PathfindingBreadcrumb[,] Points = new PathfindingBreadcrumb[ (SharedPathfindingSystem.ChunkSize) * SharedPathfindingSystem.SubStep, (SharedPathfindingSystem.ChunkSize) * SharedPathfindingSystem.SubStep]; + [ViewVariables] public Vector2i Origin; + [ViewVariables] public readonly List[] Polygons = new List[SharedPathfindingSystem.ChunkSize * SharedPathfindingSystem.ChunkSize]; /// @@ -21,11 +24,13 @@ public sealed class GridPathfindingChunk /// /// The relevant polygon for this chunk's portals /// + [ViewVariables] public readonly Dictionary PortalPolys = new(); /// /// This chunk's portals. /// + [ViewVariables] public readonly List Portals = new(); public GridPathfindingChunk() diff --git a/Content.Server/NPC/Pathfinding/GridPathfindingComponent.cs b/Content.Server/NPC/Pathfinding/GridPathfindingComponent.cs index 2d5fe8e0c7..90a083be52 100644 --- a/Content.Server/NPC/Pathfinding/GridPathfindingComponent.cs +++ b/Content.Server/NPC/Pathfinding/GridPathfindingComponent.cs @@ -1,3 +1,5 @@ +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; + namespace Content.Server.NPC.Pathfinding; /// @@ -6,19 +8,24 @@ namespace Content.Server.NPC.Pathfinding; [RegisterComponent, Access(typeof(PathfindingSystem))] public sealed class GridPathfindingComponent : Component { + [ViewVariables] public readonly HashSet DirtyChunks = new(); /// /// Next time the graph is allowed to update. /// + [ViewVariables, DataField("nextUpdate", customTypeSerializer:typeof(TimeOffsetSerializer))] public TimeSpan NextUpdate; + [ViewVariables] public readonly Dictionary Chunks = new(); /// /// Retrieves the chunk where the specified portal is stored on this grid. /// + [ViewVariables] public readonly Dictionary PortalLookup = new(); + [ViewVariables] public readonly List DirtyPortals = new(); }