Fix ItemSlots error (#5439)

* fix duplicate slots

* fix comment

* comments
This commit is contained in:
Leon Friedrich
2021-11-22 14:50:43 +13:00
committed by GitHub
parent 80989d950d
commit 4342a84884
2 changed files with 24 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.GameStates;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Player;
using Robust.Shared.Utility;
using System.Collections.Generic;
@@ -74,7 +75,8 @@ namespace Content.Shared.Containers.ItemSlots
{
var itemSlots = EntityManager.EnsureComponent<ItemSlotsComponent>(uid);
slot.ContainerSlot = ContainerHelpers.EnsureContainer<ContainerSlot>(itemSlots.Owner, id);
DebugTools.Assert(!itemSlots.Slots.ContainsKey(id));
if (itemSlots.Slots.ContainsKey(id))
Logger.Error($"Duplicate item slot key. Entity: {itemSlots.Owner.Name} ({uid}), key: {id}");
itemSlots.Slots[id] = slot;
}