From 264015346d62c2a7b30c4966a1c6a0feaa24d8be Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 3 Aug 2017 19:29:27 +0300 Subject: [PATCH] Clients ignore messages about attaching an item to a wall if the item is not attachable, and don't drop the the items before attaching (because it disconnects all connected wires). The spamevents debug command didn't work correctly because of this, and I'd imagine that the latter could have caused wires to drop from some attached items when joining mid-round. --- .../Source/Items/Components/Holdable/Holdable.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs index 654d48894..d88f654cd 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs @@ -360,9 +360,19 @@ namespace Barotrauma.Items.Components public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) { bool isAttached = msg.ReadBoolean(); + + if (!attachable) + { + DebugConsole.ThrowError("Received an attachment event for an item that's not attachable."); + return; + } + if (isAttached) { - item.Drop(); + if (item.ParentInventory != null) + { + item.ParentInventory.RemoveItem(item); + } AttachToWall(); } else