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 Barotrauma.Networking;
|
||||||
using Lidgren.Network;
|
using Lidgren.Network;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Barotrauma.Items.Components;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -281,11 +282,30 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
string toolTip = "";
|
string toolTip = "";
|
||||||
Rectangle highlightedSlot = Rectangle.Empty;
|
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;
|
doubleClickedItem = null;
|
||||||
|
|
||||||
const int rectWidth = 40, rectHeight = 40;
|
const int rectWidth = 40, rectHeight = 40;
|
||||||
|
|||||||
@@ -169,8 +169,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public virtual void Draw(SpriteBatch spriteBatch)
|
public virtual void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
doubleClickedItem = null;
|
|
||||||
|
|
||||||
string toolTip = "";
|
string toolTip = "";
|
||||||
|
|
||||||
int rectWidth = 40, rectHeight = 40;
|
int rectWidth = 40, rectHeight = 40;
|
||||||
|
|||||||
@@ -701,7 +701,7 @@ namespace Barotrauma
|
|||||||
FindHull();
|
FindHull();
|
||||||
|
|
||||||
Vector2 moveAmount = body.SimPosition - body.LastSentPosition;
|
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);
|
new NetworkEvent(NetworkEventType.PhysicsBodyPosition, ID, false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user