Make PA constructible again (#19428)

* Change construction graph correctly

https://github.com/space-wizards/space-station-14/issues/18511#issuecomment-1687893199

* Remove unnecessary call to UpdatePathfinding
This commit is contained in:
Arimah Greene
2023-09-10 05:42:42 +02:00
committed by GitHub
parent 95cca53c17
commit a6af59e3bf

View File

@@ -324,11 +324,17 @@ namespace Content.Server.Construction
}
}
// We set the graph and node accordingly.
ChangeGraph(newUid, userUid, construction.Graph, construction.Node, false, newConstruction);
// If the new entity has the *same* construction graph, stay on the same node.
// If not, we effectively restart the construction graph, so the new entity can be completed.
if (construction.Graph == newConstruction.Graph)
{
ChangeNode(newUid, userUid, construction.Node, false, newConstruction);
if (construction.TargetNode is {} targetNode)
SetPathfindingTarget(newUid, targetNode, newConstruction);
// Retain the target node if an entity change happens in response to deconstruction;
// in that case, we must continue to move towards the start node.
if (construction.TargetNode is {} targetNode)
SetPathfindingTarget(newUid, targetNode, newConstruction);
}
// Transfer all pending interaction events too.
while (construction.InteractionQueue.TryDequeue(out var ev))