Inventory slot enumerator rejig (#21788)

This commit is contained in:
Leon Friedrich
2023-12-07 16:20:51 -05:00
committed by GitHub
parent 445c474c2c
commit 287d22cc49
18 changed files with 238 additions and 342 deletions

View File

@@ -35,15 +35,13 @@ namespace Content.Server.Chemistry.EntitySystems
return;
}
if (component.BlockSlots != 0x0 && TryComp<InventoryComponent>(target, out var inventory))
if (component.BlockSlots != 0x0)
{
var containerEnumerator = new InventorySystem.ContainerSlotEnumerator(target, inventory.TemplateId, _protoManager, _inventorySystem, component.BlockSlots);
var containerEnumerator = _inventorySystem.GetSlotEnumerator(target, component.BlockSlots);
while (containerEnumerator.MoveNext(out var container))
{
if (!container.ContainedEntity.HasValue) continue;
// TODO add a helper method for this?
if (containerEnumerator.MoveNext(out _))
return;
}
}
var solRemoved = solution.SplitSolution(component.TransferAmount);