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:
Joonas Rikkonen
2018-07-30 11:00:21 +03:00
parent 9964923eba
commit c66098ca4e
5 changed files with 49 additions and 7 deletions
@@ -377,7 +377,8 @@ namespace Barotrauma
(components[componentIndex] as IServerSerializable).ClientRead(type, msg, sendingTime);
break;
case NetEntityEvent.Type.InventoryState:
ownInventory.ClientRead(type, msg, sendingTime);
int containerIndex = msg.ReadRangedInteger(0, components.Count - 1);
(components[containerIndex] as ItemContainer).Inventory.ClientRead(type, msg, sendingTime);
break;
case NetEntityEvent.Type.Status:
condition = msg.ReadRangedSingle(0.0f, prefab.Health, 8);
@@ -425,11 +426,12 @@ namespace Barotrauma
case NetEntityEvent.Type.ComponentState:
int componentIndex = (int)extraData[1];
msg.WriteRangedInteger(0, components.Count - 1, componentIndex);
(components[componentIndex] as IClientSerializable).ClientWrite(msg, extraData);
break;
case NetEntityEvent.Type.InventoryState:
ownInventory.ClientWrite(msg, extraData);
int containerIndex = (int)extraData[1];
msg.WriteRangedInteger(0, components.Count - 1, containerIndex);
(components[containerIndex] as ItemContainer).Inventory.ClientWrite(msg, extraData);
break;
case NetEntityEvent.Type.Repair:
if (FixRequirements.Count > 0)