mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add ItemStack:get_description() to get tooltip (#8847)
This commit is contained in:
parent
efbac7e446
commit
008b80fe1c
6 changed files with 33 additions and 22 deletions
|
@ -246,6 +246,14 @@ std::string ItemStack::getItemString() const
|
|||
return os.str();
|
||||
}
|
||||
|
||||
std::string ItemStack::getDescription(IItemDefManager *itemdef) const
|
||||
{
|
||||
std::string desc = metadata.getString("description");
|
||||
if (desc.empty())
|
||||
desc = getDefinition(itemdef).description;
|
||||
return desc.empty() ? name : desc;
|
||||
}
|
||||
|
||||
|
||||
ItemStack ItemStack::addItem(ItemStack newitem, IItemDefManager *itemdef)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue