Fixed clients getting desynced if cargomanager spawns extra containers due to running out of space.

This commit is contained in:
Joonas Rikkonen
2018-07-24 19:02:56 +03:00
parent 2705eddd18
commit df720b67ba

View File

@@ -152,11 +152,17 @@ namespace Barotrauma
}
for (int i = 0; i < Pi.quantity; i++)
{
//if the intial container has been removed due to it running out of space, add a new container
//of the same type and begin filling it
if (!availableContainers.ContainsKey(itemContainer))
{
Item containerItemOverFlow = new Item(containerPrefab, position, wp.Submarine);
itemContainer = containerItemOverFlow.GetComponent<ItemContainer>();
availableContainers.Add(itemContainer, itemContainer.Capacity);
if (GameMain.Server != null)
{
Entity.Spawner.CreateNetworkEvent(itemContainer.Item, false);
}
}
if (itemContainer == null)