From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Fri, 17 Feb 2023 01:30:10 +0000 (+1100) Subject: Make NPC steering actually debuggable (#14142) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=344238c0f1d0c130fa4c53268117ecaad710db58;p=space-station-14.git Make NPC steering actually debuggable (#14142) --- diff --git a/Content.Client/NPC/PathfindingSystem.cs b/Content.Client/NPC/PathfindingSystem.cs index bacf2d250f..9eb3310dc5 100644 --- a/Content.Client/NPC/PathfindingSystem.cs +++ b/Content.Client/NPC/PathfindingSystem.cs @@ -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() diff --git a/Content.Server/NPC/Pathfinding/PathPoly.cs b/Content.Server/NPC/Pathfinding/PathPoly.cs index 9f66d4a1c5..fbb2973c7e 100644 --- a/Content.Server/NPC/Pathfinding/PathPoly.cs +++ b/Content.Server/NPC/Pathfinding/PathPoly.cs @@ -5,13 +5,22 @@ namespace Content.Server.NPC.Pathfinding; public sealed class PathPoly : IEquatable { + [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 Neighbors; public PathPoly(EntityUid graphUid, Vector2i chunkOrigin, byte tileIndex, Box2 vertices, PathfindingData data, HashSet neighbors) @@ -29,6 +38,7 @@ public sealed class PathPoly : IEquatable return (Data.Flags & PathfindingBreadcrumbFlag.Invalid) == 0x0; } + [ViewVariables] public EntityCoordinates Coordinates => new(GraphUid, Box.Center); // Explicitly don't check neighbors.