]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make PA constructible again (#19428)
authorArimah Greene <30327355+arimah@users.noreply.github.com>
Sun, 10 Sep 2023 03:42:42 +0000 (05:42 +0200)
committerGitHub <noreply@github.com>
Sun, 10 Sep 2023 03:42:42 +0000 (23:42 -0400)
* Change construction graph correctly

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

* Remove unnecessary call to UpdatePathfinding

Content.Server/Construction/ConstructionSystem.Graph.cs

index 43b7b009a59746e9c85fa23fd46b6e33573e78db..5d4bcde4cecbd650a7761c9f9ed4a00ec509b966 100644 (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))