Fixed attachable items becoming detachable without any tools after they've been detached once

This commit is contained in:
Joonas Rikkonen
2017-07-08 18:32:21 +03:00
parent d4b58e16b9
commit 2598bb1bd3
@@ -2,6 +2,7 @@
using FarseerPhysics; using FarseerPhysics;
using Lidgren.Network; using Lidgren.Network;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System.Collections.Generic;
using System.Xml.Linq; using System.Xml.Linq;
namespace Barotrauma.Items.Components namespace Barotrauma.Items.Components
@@ -13,6 +14,7 @@ namespace Barotrauma.Items.Components
private InputType prevPickKey; private InputType prevPickKey;
private string prevMsg; private string prevMsg;
private List<RelatedItem> prevRequiredItems;
//the distance from the holding characters elbow to center of the physics body of the item //the distance from the holding characters elbow to center of the physics body of the item
protected Vector2 holdPos; protected Vector2 holdPos;
@@ -92,6 +94,8 @@ namespace Barotrauma.Items.Components
canBePicked = true; canBePicked = true;
prevRequiredItems = new List<RelatedItem>(requiredItems);
if (attachable) if (attachable)
{ {
prevMsg = Msg; prevMsg = Msg;
@@ -99,7 +103,7 @@ namespace Barotrauma.Items.Components
DeattachFromWall(); DeattachFromWall();
} }
if ((Screen.Selected == GameMain.EditMapScreen)) Use(1.0f); if ((Screen.Selected == GameMain.EditMapScreen)) Use(1.0f);
} }
@@ -238,6 +242,7 @@ namespace Barotrauma.Items.Components
Msg = prevMsg; Msg = prevMsg;
PickKey = prevPickKey; PickKey = prevPickKey;
requiredItems = new List<RelatedItem>(prevRequiredItems);
attached = true; attached = true;
} }
@@ -304,7 +309,7 @@ namespace Barotrauma.Items.Components
public override void OnMapLoaded() public override void OnMapLoaded()
{ {
//prevRequiredItems = new List<RelatedItem>(requiredItems); prevRequiredItems = new List<RelatedItem>(requiredItems);
if (!attachable) return; if (!attachable) return;