Vending machines now show entity name rather than prototype ID (#355)

This commit is contained in:
DamianX
2019-09-20 20:39:54 +02:00
committed by Pieter-Jan Briers
parent 0090af6b3b
commit a4aab7dbd1

View File

@@ -48,12 +48,14 @@ namespace Content.Client.VendingMachines
_cachedInventory = inventory; _cachedInventory = inventory;
foreach (VendingMachineInventoryEntry entry in inventory) foreach (VendingMachineInventoryEntry entry in inventory)
{ {
var itemName = _prototypeManager.Index<EntityPrototype>(entry.ID).Name;
Texture icon = null; Texture icon = null;
if(_prototypeManager.TryIndex(entry.ID, out EntityPrototype prototype)) if(_prototypeManager.TryIndex(entry.ID, out EntityPrototype prototype))
{ {
icon = IconComponent.GetPrototypeIcon(prototype, _resourceCache).TextureFor(Direction.South); icon = IconComponent.GetPrototypeIcon(prototype, _resourceCache).TextureFor(Direction.South);
} }
_items.AddItem($"{entry.ID} ({entry.Amount} left)", icon); _items.AddItem($"{itemName} ({entry.Amount} left)", icon);
} }
} }