From db7d5539e05b40ab78296bcafb7e094be7b36dda Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 7 Dec 2017 20:20:05 +0200 Subject: [PATCH] Fixed modified clients being able to disconnect locked wires --- .../BarotraumaShared/Source/Characters/Character.cs | 3 +++ .../Source/Items/Components/Signal/ConnectionPanel.cs | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs index 954cfd211..a506e62d1 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/Character.cs @@ -1059,6 +1059,9 @@ namespace Barotrauma Wire wire = item.GetComponent(); if (wire != null) { + //locked wires are never interactable + if (wire.Locked) return false; + //wires are interactable if the character has selected either of the items the wire is connected to if (wire.Connections[0]?.Item != null && selectedConstruction == wire.Connections[0].Item) return true; if (wire.Connections[1]?.Item != null && selectedConstruction == wire.Connections[1].Item) return true; diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/ConnectionPanel.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/ConnectionPanel.cs index 9b47514de..7b25c669b 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/ConnectionPanel.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Signal/ConnectionPanel.cs @@ -212,6 +212,14 @@ namespace Barotrauma.Items.Components //existing wire not in the list of new wires -> disconnect it if (!wires[i].Contains(existingWire)) { + if (existingWire.Locked) + { + //this should not be possible unless the client is running a modified version of the game + GameServer.Log(c.Character.Name + " attempted to disconnect a locked wire from " + + Connections[i].Item.Name + " (" + Connections[i].Name + ")", ServerLog.MessageType.Error); + continue; + } + existingWire.RemoveConnection(item); if (existingWire.Connections[0] == null && existingWire.Connections[1] == null)