PhysicsBodyPosition networkevents aren't sent for items that are inside an inventory (e.g. carried by a character), items can be moved from the inventory to containers by double clicking
This commit is contained in:
@@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Input;
|
||||
using Barotrauma.Networking;
|
||||
using Lidgren.Network;
|
||||
using System.Collections.Generic;
|
||||
using Barotrauma.Items.Components;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -281,11 +282,30 @@ namespace Barotrauma
|
||||
{
|
||||
string toolTip = "";
|
||||
Rectangle highlightedSlot = Rectangle.Empty;
|
||||
|
||||
if (doubleClickedItem!=null && doubleClickedItem.ParentInventory!=this)
|
||||
|
||||
if (doubleClickedItem != null)
|
||||
{
|
||||
TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots, true);
|
||||
if (doubleClickedItem.ParentInventory != this)
|
||||
{
|
||||
TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (character.SelectedConstruction != null)
|
||||
{
|
||||
var selectedContainer = character.SelectedConstruction.GetComponent<ItemContainer>();
|
||||
if (selectedContainer != null && selectedContainer.Inventory != null)
|
||||
{
|
||||
selectedContainer.Inventory.TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots, true);
|
||||
}
|
||||
}
|
||||
else if (character.SelectedCharacter != null && character.SelectedCharacter.Inventory != null)
|
||||
{
|
||||
character.SelectedCharacter.Inventory.TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doubleClickedItem = null;
|
||||
|
||||
const int rectWidth = 40, rectHeight = 40;
|
||||
|
||||
@@ -169,8 +169,6 @@ namespace Barotrauma
|
||||
|
||||
public virtual void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
doubleClickedItem = null;
|
||||
|
||||
string toolTip = "";
|
||||
|
||||
int rectWidth = 40, rectHeight = 40;
|
||||
|
||||
@@ -701,7 +701,7 @@ namespace Barotrauma
|
||||
FindHull();
|
||||
|
||||
Vector2 moveAmount = body.SimPosition - body.LastSentPosition;
|
||||
if (moveAmount != Vector2.Zero && moveAmount.Length() > NetConfig.ItemPosUpdateDistance)
|
||||
if (parentInventory == null && moveAmount != Vector2.Zero && moveAmount.Length() > NetConfig.ItemPosUpdateDistance)
|
||||
{
|
||||
new NetworkEvent(NetworkEventType.PhysicsBodyPosition, ID, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user