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:
@@ -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,7 +447,7 @@ 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);
|
||||||
@@ -455,16 +455,19 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DropConnectedWires(null);
|
if (attached)
|
||||||
|
|
||||||
if (body != null)
|
|
||||||
{
|
{
|
||||||
item.body = body;
|
DropConnectedWires(null);
|
||||||
item.body.Enabled = true;
|
|
||||||
}
|
|
||||||
IsActive = false;
|
|
||||||
|
|
||||||
DeattachFromWall();
|
if (body != null)
|
||||||
|
{
|
||||||
|
item.body = body;
|
||||||
|
item.body.Enabled = true;
|
||||||
|
}
|
||||||
|
IsActive = false;
|
||||||
|
|
||||||
|
DeattachFromWall();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user