Fixed attachable items dropping on the ground when deattaching them (but still staying in the inventory of the character detaching them). Closes #559

This commit is contained in:
Joonas Rikkonen
2018-08-02 12:18:03 +03:00
parent 1379460ad9
commit 9ab5d76ed1
@@ -438,7 +438,7 @@ namespace Barotrauma.Items.Components
public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime) public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
{ {
bool isAttached = msg.ReadBoolean(); bool shouldBeAttached = msg.ReadBoolean();
Vector2 simPosition = new Vector2(msg.ReadFloat(), msg.ReadFloat()); Vector2 simPosition = new Vector2(msg.ReadFloat(), msg.ReadFloat());
if (!attachable) if (!attachable)
@@ -447,13 +447,15 @@ namespace Barotrauma.Items.Components
return; return;
} }
if (isAttached) if (shouldBeAttached)
{ {
Drop(false, null); Drop(false, null);
item.SetTransform(simPosition, 0.0f); item.SetTransform(simPosition, 0.0f);
AttachToWall(); AttachToWall();
} }
else else
{
if (attached)
{ {
DropConnectedWires(null); DropConnectedWires(null);
@@ -469,3 +471,4 @@ namespace Barotrauma.Items.Components
} }
} }
} }
}