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

@@ -90,11 +90,11 @@ namespace Content.Client.Inventory
_strippingMenu.ClearButtons();
if (EntMan.TryGetComponent<InventoryComponent>(Owner, out var inv) && _protoMan.TryIndex<InventoryTemplatePrototype>(inv.TemplateId, out var template))
if (EntMan.TryGetComponent<InventoryComponent>(Owner, out var inv))
{
foreach (var slot in template.Slots)
foreach (var slot in inv.Slots)
{
AddInventoryButton(Owner, slot.Name, template, inv);
AddInventoryButton(Owner, slot.Name, inv);
}
}
@@ -190,7 +190,7 @@ namespace Content.Client.Inventory
_ui.GetUIController<VerbMenuUIController>().OpenVerbMenu(slot.Entity.Value);
}
private void AddInventoryButton(EntityUid invUid, string slotId, InventoryTemplatePrototype _, InventoryComponent inv)
private void AddInventoryButton(EntityUid invUid, string slotId, InventoryComponent inv)
{
if (!_inv.TryGetSlotContainer(invUid, slotId, out var container, out var slotDef, inv))
return;