summaryrefslogtreecommitdiff
path: root/group.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-08-07 01:39:19 +0200
committerWuzzy <almikes@aol.com>2016-08-14 23:36:12 +0200
commit15f5b8e8042c635d801320a606c214643d178062 (patch)
tree6d2f985b7b3de3b8162ffd8427233c6246a45419 /group.lua
parentc9d794284074dd1b3dc38a91f3dc103e5b604a4d (diff)
Craftguide: Use better tooltips for group buttons
Diffstat (limited to 'group.lua')
-rw-r--r--group.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/group.lua b/group.lua
index 7f79a39..23e2587 100644
--- a/group.lua
+++ b/group.lua
@@ -1,3 +1,5 @@
+local S = unified_inventory.gettext
+
function unified_inventory.canonical_item_spec_matcher(spec)
local specname = ItemStack(spec):get_name()
if specname:sub(1, 6) == "group:" then
@@ -21,6 +23,27 @@ function unified_inventory.item_matches_spec(item, spec)
return unified_inventory.canonical_item_spec_matcher(spec)(itemname)
end
+function unified_inventory.extract_groupnames(groupname)
+ local specname = ItemStack(groupname):get_name()
+ if specname:sub(1, 6) == "group:" then
+ local group_names = specname:sub(7):split(",")
+ if #group_names == 1 then
+ return group_names[1], 1
+ end
+ local s = ""
+ for g=1,#group_names do
+ if g > 1 then
+ -- List connector
+ s = s .. S(" and ")
+ end
+ s = s .. group_names[g]
+ end
+ return s, #group_names
+ else
+ return nil, 0
+ end
+end
+
unified_inventory.registered_group_items = {
mesecon_conductor_craftable = "mesecons:wire_00000000_off",
stone = "default:cobble",