Fixed only the first inventory of an item being synced (e.g. clients wouldn't get notified when an item is contained in the "output inventory" of a fabricator or deconstructor).
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Barotrauma.Items.Components;
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -84,6 +85,27 @@ namespace Barotrauma
|
||||
return wasPut;
|
||||
}
|
||||
|
||||
protected override void CreateNetworkEvent()
|
||||
{
|
||||
int componentIndex = container.Item.components.IndexOf(container);
|
||||
if (componentIndex == -1)
|
||||
{
|
||||
DebugConsole.Log("Creating a network event for the item \"" + container.Item + "\" failed, ItemContainer not found in components");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
GameMain.Server.CreateEntityEvent(Owner as IServerSerializable, new object[] { NetEntityEvent.Type.InventoryState, componentIndex });
|
||||
}
|
||||
#if CLIENT
|
||||
else if (GameMain.Client != null)
|
||||
{
|
||||
GameMain.Client.CreateEntityEvent(Owner as IClientSerializable, new object[] { NetEntityEvent.Type.InventoryState, componentIndex });
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void RemoveItem(Item item)
|
||||
{
|
||||
base.RemoveItem(item);
|
||||
|
||||
Reference in New Issue
Block a user