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

@@ -368,15 +368,12 @@ namespace Content.Server.Administration.Systems
}
}
if (TryComp(entity.Value, out InventoryComponent? inventory) &&
_inventory.TryGetSlots(entity.Value, out var slots, inventory))
if (_inventory.TryGetContainerSlotEnumerator(entity.Value, out var enumerator))
{
foreach (var slot in slots)
while (enumerator.NextItem(out var item, out var slot))
{
if (_inventory.TryUnequip(entity.Value, entity.Value, slot.Name, out var item, true, true))
{
_physics.ApplyAngularImpulse(item.Value, ThrowingSystem.ThrowAngularImpulse);
}
if (_inventory.TryUnequip(entity.Value, entity.Value, slot.Name, true, true))
_physics.ApplyAngularImpulse(item, ThrowingSystem.ThrowAngularImpulse);
}
}