summaryrefslogtreecommitdiff
path: root/register.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2016-08-14 19:43:08 -0400
committerGitHub <noreply@github.com>2016-08-14 19:43:08 -0400
commitf6ea3daef7ab6acdf4156e8e8347c3d536bb4fb4 (patch)
tree6d2f985b7b3de3b8162ffd8427233c6246a45419 /register.lua
parentdba69b1f7116bdb0f4c9be3dafd411db757e14ec (diff)
parent15f5b8e8042c635d801320a606c214643d178062 (diff)
Merge pull request #63 from Wuzzy2/search
Improve search and group handling and related usability
Diffstat (limited to 'register.lua')
-rw-r--r--register.lua21
1 files changed, 17 insertions, 4 deletions
diff --git a/register.lua b/register.lua
index 55bbdb0..ff38168 100644
--- a/register.lua
+++ b/register.lua
@@ -188,11 +188,24 @@ local function stack_image_button(x, y, w, h, buttonname_prefix, item)
selectitem = group_item.sole and displayitem or name
end
local label = show_is_group and "G" or ""
- return string.format("item_image_button[%f,%f;%f,%f;%s;%s;%s]",
+ local buttonname = minetest.formspec_escape(buttonname_prefix..unified_inventory.mangle_for_formspec(selectitem))
+ local button = string.format("item_image_button[%f,%f;%f,%f;%s;%s;%s]",
x, y, w, h,
- minetest.formspec_escape(displayitem),
- minetest.formspec_escape(buttonname_prefix..unified_inventory.mangle_for_formspec(selectitem)),
- label)
+ minetest.formspec_escape(displayitem), buttonname, label)
+ if show_is_group then
+ local groupstring, andcount = unified_inventory.extract_groupnames(name)
+ local grouptip
+ if andcount == 1 then
+ grouptip = string.format(S("Any item belonging to the %s group"), groupstring)
+ elseif andcount > 1 then
+ grouptip = string.format(S("Any item belonging to the groups %s"), groupstring)
+ end
+ grouptip = minetest.formspec_escape(grouptip)
+ if andcount >= 1 then
+ button = button .. string.format("tooltip[%s;%s]", buttonname, grouptip)
+ end
+ end
+ return button
end
local recipe_text = {