From a6af59e3bfcd6dff0579e5bda27e98cf4b65b10a Mon Sep 17 00:00:00 2001 From: Arimah Greene <30327355+arimah@users.noreply.github.com> Date: Sun, 10 Sep 2023 05:42:42 +0200 Subject: [PATCH] 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 --- .../Construction/ConstructionSystem.Graph.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Content.Server/Construction/ConstructionSystem.Graph.cs b/Content.Server/Construction/ConstructionSystem.Graph.cs index 43b7b009a5..5d4bcde4ce 100644 --- a/Content.Server/Construction/ConstructionSystem.Graph.cs +++ b/Content.Server/Construction/ConstructionSystem.Graph.cs @@ -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))