Update ClientInventoryComponent.cs

Fixed HandleComponentState so that it only updates the inventory when there are changes.
This commit is contained in:
ShadowCommander
2019-07-28 17:24:15 -07:00
parent e5d9634cfe
commit bb20243b05

View File

@@ -1,7 +1,10 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.Components.Clothing;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Inventory;
using Content.Shared.GameObjects.Components.Storage;
using Robust.Client.GameObjects;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
@@ -76,15 +79,12 @@ namespace Content.Client.GameObjects
foreach (var (slot, entityUid) in cast.Entities)
{
if (_slots.ContainsKey(slot))
{
_slots.Remove(slot);
_clearSlot(slot);
}
var entity = Owner.EntityManager.GetEntity(entityUid);
_slots[slot] = entity;
_setSlot(slot, entity);
if (!_slots.ContainsKey(slot) || _slots[slot] != entity)
{
_slots[slot] = entity;
_setSlot(slot, entity);
}
doneSlots.Add(slot);
}