From 8442a9142c28917553fb35c6e63695fcbfc62fe2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20M=C4=99drek?= Date: Sat, 27 Apr 2024 06:30:29 +0000 Subject: [PATCH] fix: deconstruct verb on undeconstructables (#27387) 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 --- .../Construction/ConstructionSystem.Guided.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Content.Server/Construction/ConstructionSystem.Guided.cs b/Content.Server/Construction/ConstructionSystem.Guided.cs index fe7f9152c0..e096bc02c3 100644 --- a/Content.Server/Construction/ConstructionSystem.Guided.cs +++ b/Content.Server/Construction/ConstructionSystem.Guided.cs @@ -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 -- 2.52.0