Don't pathfind on deleted grid (#8300)
This commit is contained in:
@@ -16,17 +16,20 @@ namespace Content.Server.AI.Pathfinding.Pathfinders
|
||||
private readonly PathfindingNode? _startNode;
|
||||
private PathfindingNode? _endNode;
|
||||
private readonly PathfindingArgs _pathfindingArgs;
|
||||
private readonly IEntityManager _entityManager;
|
||||
|
||||
public AStarPathfindingJob(
|
||||
double maxTime,
|
||||
PathfindingNode startNode,
|
||||
PathfindingNode endNode,
|
||||
PathfindingArgs pathfindingArgs,
|
||||
CancellationToken cancellationToken) : base(maxTime, cancellationToken)
|
||||
CancellationToken cancellationToken,
|
||||
IEntityManager entityManager) : base(maxTime, cancellationToken)
|
||||
{
|
||||
_startNode = startNode;
|
||||
_endNode = endNode;
|
||||
_pathfindingArgs = pathfindingArgs;
|
||||
_entityManager = entityManager;
|
||||
}
|
||||
|
||||
protected override async Task<Queue<TileRef>?> Process()
|
||||
@@ -44,6 +47,9 @@ namespace Content.Server.AI.Pathfinding.Pathfinders
|
||||
return null;
|
||||
}
|
||||
|
||||
if (_entityManager.Deleted(_pathfindingArgs.Start.GridIndex))
|
||||
return null;
|
||||
|
||||
var frontier = new PriorityQueue<ValueTuple<float, PathfindingNode>>(new PathfindingComparer());
|
||||
var costSoFar = new Dictionary<PathfindingNode, float>();
|
||||
var cameFrom = new Dictionary<PathfindingNode, PathfindingNode>();
|
||||
|
||||
Reference in New Issue
Block a user