1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-26 18:21:04 +00:00

Add per-stack descriptions using ItemStack Metadata

This commit is contained in:
rubenwardy 2017-02-03 22:28:09 +00:00
parent f2aa2c6a98
commit f2f9a92351
2 changed files with 10 additions and 1 deletions

View file

@ -2303,7 +2303,12 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase,
// Draw tooltip
std::wstring tooltip_text = L"";
if (hovering && !m_selected_item) {
tooltip_text = utf8_to_wide(item.getDefinition(m_client->idef()).description);
const std::string &desc = item.metadata.getString("description");
if (desc.empty())
tooltip_text =
utf8_to_wide(item.getDefinition(m_client->idef()).description);
else
tooltip_text = utf8_to_wide(desc);
}
if (tooltip_text != L"") {
std::vector<std::wstring> tt_rows = str_split(tooltip_text, L'\n');