Inventory.TryPutItem doesn't put an item in the inventory (or create a NetEntityEvent) if the item is already in it
This commit is contained in:
@@ -143,7 +143,16 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
public override bool TryPutItem(Item item, List<InvSlotType> allowedSlots = null, bool createNetworkEvent = true)
|
||||
{
|
||||
if (allowedSlots == null || ! allowedSlots.Any()) return false;
|
||||
if (allowedSlots == null || !allowedSlots.Any()) return false;
|
||||
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
//already in the inventory and in a suitable slot
|
||||
if (Items[i] == item && allowedSlots.Any(a => a.HasFlag(limbSlots[i])))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//try to place the item in LimBlot.Any slot if that's allowed
|
||||
if (allowedSlots.Contains(InvSlotType.Any))
|
||||
|
||||
@@ -568,7 +568,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
var item = Entity.FindEntityByID(newItemIDs[i]) as Item;
|
||||
if (item == null) continue;
|
||||
if (item == null || item == Items[i]) continue;
|
||||
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
long msgPosition = msg.Position;
|
||||
|
||||
DebugConsole.NewMessage("received msg "+thisEventID, Microsoft.Xna.Framework.Color.Green);
|
||||
DebugConsole.NewMessage("received msg "+thisEventID+ " ("+entity.ToString()+")", Microsoft.Xna.Framework.Color.Green);
|
||||
lastReceivedID++;
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user