From 2598bb1bd3248824ee1082b0fad194dff2607311 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sat, 8 Jul 2017 18:32:21 +0300 Subject: [PATCH] Fixed attachable items becoming detachable without any tools after they've been detached once --- .../Source/Items/Components/Holdable/Holdable.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs index 3e78b8fb9..c891dfc79 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Holdable/Holdable.cs @@ -2,6 +2,7 @@ using FarseerPhysics; using Lidgren.Network; using Microsoft.Xna.Framework; +using System.Collections.Generic; using System.Xml.Linq; namespace Barotrauma.Items.Components @@ -13,6 +14,7 @@ namespace Barotrauma.Items.Components private InputType prevPickKey; private string prevMsg; + private List prevRequiredItems; //the distance from the holding characters elbow to center of the physics body of the item protected Vector2 holdPos; @@ -92,6 +94,8 @@ namespace Barotrauma.Items.Components canBePicked = true; + prevRequiredItems = new List(requiredItems); + if (attachable) { prevMsg = Msg; @@ -99,7 +103,7 @@ namespace Barotrauma.Items.Components DeattachFromWall(); } - + if ((Screen.Selected == GameMain.EditMapScreen)) Use(1.0f); } @@ -238,6 +242,7 @@ namespace Barotrauma.Items.Components Msg = prevMsg; PickKey = prevPickKey; + requiredItems = new List(prevRequiredItems); attached = true; } @@ -304,7 +309,7 @@ namespace Barotrauma.Items.Components public override void OnMapLoaded() { - //prevRequiredItems = new List(requiredItems); + prevRequiredItems = new List(requiredItems); if (!attachable) return;