From df720b67ba4d910f80acd66ff1179d8b06a4b13b Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Tue, 24 Jul 2018 19:02:56 +0300 Subject: [PATCH] Fixed clients getting desynced if cargomanager spawns extra containers due to running out of space. --- .../BarotraumaShared/Source/GameSession/CargoManager.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs b/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs index 31aa45682..a3cad0948 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSession/CargoManager.cs @@ -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(); availableContainers.Add(itemContainer, itemContainer.Capacity); + if (GameMain.Server != null) + { + Entity.Spawner.CreateNetworkEvent(itemContainer.Item, false); + } } if (itemContainer == null)