From 3db407fe5206fcfe55721881db83ecd02a4a274b Mon Sep 17 00:00:00 2001 From: juanjp600 Date: Sun, 3 Dec 2017 11:59:29 -0300 Subject: [PATCH] Fixed wire connections being lost when copy-pasting in sub editor --- .../Source/Items/Components/Signal/ConnectionPanel.cs | 5 +++++ Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/ConnectionPanel.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/ConnectionPanel.cs index 4e14f7abf..9b47514de 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/ConnectionPanel.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/ConnectionPanel.cs @@ -120,6 +120,11 @@ namespace Barotrauma.Items.Components return componentElement; } + protected override void ShallowRemoveComponentSpecific() + { + //do nothing + } + protected override void RemoveComponentSpecific() { foreach (Connection c in Connections) diff --git a/Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs b/Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs index a2922630d..f8daabce2 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/MapEntity.cs @@ -223,9 +223,8 @@ namespace Barotrauma //index of the connection in the connectionpanel of the target item int connectionIndex = connectedItem.Connections.IndexOf(originalWire.Connections[n]); - (clones[itemIndex] as Item).GetComponent().Connections[connectionIndex].TryAddLink(cloneWire); + (clones[itemIndex] as Item).Connections[connectionIndex].TryAddLink(cloneWire); cloneWire.Connect((clones[itemIndex] as Item).Connections[connectionIndex], false); - } }