From 3bc7a0f97d5aac3522ebb0054e383c892d61d0d1 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 18 Sep 2019 18:55:55 +0200 Subject: [PATCH] worldedit_gui: Add tooltips to node search result --- worldedit_gui/functionality.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/worldedit_gui/functionality.lua b/worldedit_gui/functionality.lua index 884ec1d..7c9d587 100644 --- a/worldedit_gui/functionality.lua +++ b/worldedit_gui/functionality.lua @@ -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