]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix: deconstruct verb on undeconstructables (#27387)
authorŁukasz Mędrek <lukasz@lukaszm.xyz>
Sat, 27 Apr 2024 06:30:29 +0000 (06:30 +0000)
committerGitHub <noreply@github.com>
Sat, 27 Apr 2024 06:30:29 +0000 (16:30 +1000)
Some of prototypes don't specify their deconstructTarget node, which
made them show the deconstruct verb as deconstructTarget is set to
"start" node by default. This patch makes attempt to check if is it even
possible from current construction node to reach specified
deconstructTarget.

Fixes #27330

Content.Server/Construction/ConstructionSystem.Guided.cs

index fe7f9152c0b4fea794a1c9623a11d8ab993fc7a6..e096bc02c3157248159c9945891274f4ea5c9369 100644 (file)
@@ -41,6 +41,18 @@ namespace Content.Server.Construction
                 component.Node == component.DeconstructionNode)
                 return;
 
+            if (!_prototypeManager.TryIndex(component.Graph, out ConstructionGraphPrototype? graph))
+                return;
+
+            if (component.DeconstructionNode == null)
+                return;
+
+            if (GetCurrentNode(uid, component) is not {} currentNode)
+                return;
+
+            if (graph.Path(currentNode.Name, component.DeconstructionNode) is not {} path || path.Length == 0)
+                return;
+
             Verb verb = new();
             //verb.Category = VerbCategories.Construction;
             //TODO VERBS add more construction verbs? Until then, removing construction category