]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make NPC steering actually debuggable (#14142)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Fri, 17 Feb 2023 01:30:10 +0000 (12:30 +1100)
committerGitHub <noreply@github.com>
Fri, 17 Feb 2023 01:30:10 +0000 (12:30 +1100)
Content.Client/NPC/PathfindingSystem.cs
Content.Server/NPC/Pathfinding/PathPoly.cs

index bacf2d250f37c6dc5e85d1909abaefe67bef41e7..9eb3310dc5778de7e7b1694d17b7ecaf8abb8d69 100644 (file)
@@ -18,6 +18,7 @@ namespace Content.Client.NPC
         [Dependency] private readonly IInputManager _inputManager = default!;
         [Dependency] private readonly IMapManager _mapManager = default!;
         [Dependency] private readonly IResourceCache _cache = default!;
+        [Dependency] private readonly NPCSteeringSystem _steering = default!;
 
         public PathfindingDebugMode Modes
         {
@@ -37,6 +38,15 @@ namespace Content.Client.NPC
                     overlayManager.AddOverlay(new PathfindingOverlay(EntityManager, _eyeManager, _inputManager, _mapManager, _cache, this));
                 }
 
+                if ((value & PathfindingDebugMode.Steering) != 0x0)
+                {
+                    _steering.DebugEnabled = true;
+                }
+                else
+                {
+                    _steering.DebugEnabled = false;
+                }
+
                 _modes = value;
 
                 RaiseNetworkEvent(new RequestPathfindingDebugMessage()
index 9f66d4a1c536d78054a6012a78d259f96f5eab42..fbb2973c7e0b88450187baec142501f0f83a5259 100644 (file)
@@ -5,13 +5,22 @@ namespace Content.Server.NPC.Pathfinding;
 
 public sealed class PathPoly : IEquatable<PathPoly>
 {
+    [ViewVariables]
     public readonly EntityUid GraphUid;
+
+    [ViewVariables]
     public readonly Vector2i ChunkOrigin;
+
+    [ViewVariables]
     public readonly byte TileIndex;
 
+    [ViewVariables]
     public readonly Box2 Box;
+
+    [ViewVariables]
     public PathfindingData Data;
 
+    [ViewVariables]
     public readonly HashSet<PathPoly> Neighbors;
 
     public PathPoly(EntityUid graphUid, Vector2i chunkOrigin, byte tileIndex, Box2 vertices, PathfindingData data, HashSet<PathPoly> neighbors)
@@ -29,6 +38,7 @@ public sealed class PathPoly : IEquatable<PathPoly>
         return (Data.Flags & PathfindingBreadcrumbFlag.Invalid) == 0x0;
     }
 
+    [ViewVariables]
     public EntityCoordinates Coordinates => new(GraphUid, Box.Center);
 
     // Explicitly don't check neighbors.