worldedit_gui: Add tooltips to node search result

This commit is contained in:
sfan5 2019-09-18 18:55:55 +02:00
parent 45acf09e4a
commit 3bc7a0f97d
1 changed files with 7 additions and 2 deletions

View File

@ -52,8 +52,13 @@ end
-- display node (or unknown_node image otherwise) at specified pos in formspec
local formspec_node = function(pos, nodename)
return nodename and string.format("item_image[%s;1,1;%s]", pos, nodename)
or string.format("image[%s;1,1;worldedit_gui_unknown.png]", pos)
if nodename then
local ndef = minetest.registered_nodes[nodename] or {}
return string.format("item_image[%s;1,1;%s]", pos, nodename) ..
string.format("tooltip[%s;1,1;%s]", pos, minetest.formspec_escape(ndef.description))
else
return string.format("image[%s;1,1;worldedit_gui_unknown.png]", pos)
end
end
-- two further priv helpers