mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add ability to override item images using meta (#12614)
This commit is contained in:
parent
8c2c7fadbf
commit
4158b72971
13 changed files with 200 additions and 151 deletions
|
@ -272,6 +272,50 @@ std::string ItemStack::getShortDescription(const IItemDefManager *itemdef) const
|
|||
return desc;
|
||||
}
|
||||
|
||||
std::string ItemStack::getInventoryImage(const IItemDefManager *itemdef) const
|
||||
{
|
||||
std::string texture = metadata.getString("inventory_image");
|
||||
if (texture.empty())
|
||||
texture = getDefinition(itemdef).inventory_image;
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
std::string ItemStack::getInventoryOverlay(const IItemDefManager *itemdef) const
|
||||
{
|
||||
std::string texture = metadata.getString("inventory_overlay");
|
||||
if (texture.empty())
|
||||
texture = getDefinition(itemdef).inventory_overlay;
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
std::string ItemStack::getWieldImage(const IItemDefManager *itemdef) const
|
||||
{
|
||||
std::string texture = metadata.getString("wield_image");
|
||||
if (texture.empty())
|
||||
texture = getDefinition(itemdef).wield_image;
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
std::string ItemStack::getWieldOverlay(const IItemDefManager *itemdef) const
|
||||
{
|
||||
std::string texture = metadata.getString("wield_overlay");
|
||||
if (texture.empty())
|
||||
texture = getDefinition(itemdef).wield_overlay;
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
v3f ItemStack::getWieldScale(const IItemDefManager *itemdef) const
|
||||
{
|
||||
std::string scale = metadata.getString("wield_scale");
|
||||
if (scale.empty())
|
||||
return getDefinition(itemdef).wield_scale;
|
||||
|
||||
return str_to_v3f(scale);
|
||||
}
|
||||
|
||||
ItemStack ItemStack::addItem(ItemStack newitem, IItemDefManager *itemdef)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue