mirror of https://github.com/minetest/minetest.git
Merge pull request #1 from sofar/3984
Display custom metedata description instead of node name in tooltip.
This commit is contained in:
commit
46bc51e4b5
|
@ -2243,8 +2243,14 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase,
|
|||
|
||||
// Draw tooltip
|
||||
std::string tooltip_text = "";
|
||||
if (hovering && !m_selected_item)
|
||||
if (hovering && !m_selected_item) {
|
||||
ItemStackMetadata *meta = &item.metadata;
|
||||
std::string desc = meta->getString("description");
|
||||
if (desc != "")
|
||||
tooltip_text = desc;
|
||||
else
|
||||
tooltip_text = item.getDefinition(m_gamedef->idef()).description;
|
||||
}
|
||||
if (tooltip_text != "") {
|
||||
std::vector<std::string> tt_rows = str_split(tooltip_text, '\n');
|
||||
m_tooltip_element->setBackgroundColor(m_default_tooltip_bgcolor);
|
||||
|
|
Loading…
Reference in New Issue