More container pruning (#8576)
This commit is contained in:
@@ -22,6 +22,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
public sealed class ItemSlotsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containers = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
@@ -72,7 +73,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
{
|
||||
foreach (var (id, slot) in itemSlots.Slots)
|
||||
{
|
||||
slot.ContainerSlot = ContainerHelpers.EnsureContainer<ContainerSlot>(itemSlots.Owner, id);
|
||||
slot.ContainerSlot = _containers.EnsureContainer<ContainerSlot>(itemSlots.Owner, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +84,7 @@ namespace Content.Shared.Containers.ItemSlots
|
||||
public void AddItemSlot(EntityUid uid, string id, ItemSlot slot)
|
||||
{
|
||||
var itemSlots = EntityManager.EnsureComponent<ItemSlotsComponent>(uid);
|
||||
slot.ContainerSlot = ContainerHelpers.EnsureContainer<ContainerSlot>(itemSlots.Owner, id);
|
||||
slot.ContainerSlot = _containers.EnsureContainer<ContainerSlot>(itemSlots.Owner, id);
|
||||
if (itemSlots.Slots.ContainsKey(id))
|
||||
Logger.Error($"Duplicate item slot key. Entity: {EntityManager.GetComponent<MetaDataComponent>(itemSlots.Owner).EntityName} ({uid}), key: {id}");
|
||||
itemSlots.Slots[id] = slot;
|
||||
|
||||
@@ -9,6 +9,8 @@ public abstract class SharedPowerCellSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
|
||||
|
||||
public const string CellSlotContainer = "cell_slot";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -58,7 +60,7 @@ public abstract class SharedPowerCellSystem : EntitySystem
|
||||
|
||||
private void OnCellSlotInit(EntityUid uid, PowerCellSlotComponent component, ComponentInit args)
|
||||
{
|
||||
_itemSlotsSystem.AddItemSlot(uid, "cellslot_cell_container", component.CellSlot);
|
||||
_itemSlotsSystem.AddItemSlot(uid, CellSlotContainer, component.CellSlot);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(component.CellSlot.Name) &&
|
||||
!string.IsNullOrWhiteSpace(component.SlotName))
|
||||
|
||||
Reference in New Issue
Block a user