Vending machines now show entity name rather than prototype ID (#355)
This commit is contained in:
committed by
Pieter-Jan Briers
parent
0090af6b3b
commit
a4aab7dbd1
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user