Make NPC steering actually debuggable (#14142)

This commit is contained in:
metalgearsloth
2023-02-17 12:30:10 +11:00
committed by GitHub
parent 85227a4c09
commit 344238c0f1
2 changed files with 20 additions and 0 deletions

View 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()

View 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.