From bb20243b05cc6f506fc5bdd1b2cc2b6140f36d43 Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Sun, 28 Jul 2019 17:24:15 -0700 Subject: [PATCH] Update ClientInventoryComponent.cs Fixed HandleComponentState so that it only updates the inventory when there are changes. --- .../HUD/Inventory/ClientInventoryComponent.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs index 0d672b28d2..da5613447f 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs @@ -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); }