diff --git a/mods/unified_inventory/api.lua b/mods/unified_inventory/api.lua index f6a68d69..a95d3133 100755 --- a/mods/unified_inventory/api.lua +++ b/mods/unified_inventory/api.lua @@ -19,7 +19,20 @@ minetest.after(0.01, function() local recipes = minetest.get_all_craft_recipes(name) if recipes then for _, recipe in ipairs(recipes) do - unified_inventory.register_craft(recipe) + + local unknowns + + for _,chk in pairs(recipe.items) do + local groupchk = string.find(chk, "group:") + if (not groupchk and not minetest.registered_items[chk]) + or (groupchk and not unified_inventory.get_group_item(string.gsub(chk, "group:", "")).item) then + unknowns = true + end + end + + if not unknowns then + unified_inventory.register_craft(recipe) + end end end end diff --git a/mods/unified_inventory/bags.lua b/mods/unified_inventory/bags.lua index 904ed642..b92eb87d 100755 --- a/mods/unified_inventory/bags.lua +++ b/mods/unified_inventory/bags.lua @@ -3,13 +3,7 @@ -- Copyright (c) 2012 cornernote, Brett O'Donnell -- License: GPLv3 -local S -if (minetest.get_modpath("intllib")) then - dofile(minetest.get_modpath("intllib").."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function(s) return s end -end +local S = unified_inventory.gettext unified_inventory.register_page("bags", { get_formspec = function(player) diff --git a/mods/unified_inventory/init.lua b/mods/unified_inventory/init.lua index 4ffff149..4abbcc85 100755 --- a/mods/unified_inventory/init.lua +++ b/mods/unified_inventory/init.lua @@ -83,3 +83,4 @@ dofile(modpath.."/item_names.lua") if minetest.get_modpath("datastorage") and not unified_inventory.lite_mode then dofile(modpath.."/waypoints.lua") end + diff --git a/mods/unified_inventory/internal.lua b/mods/unified_inventory/internal.lua index 3c4b5561..75120ad6 100755 --- a/mods/unified_inventory/internal.lua +++ b/mods/unified_inventory/internal.lua @@ -1,10 +1,4 @@ -local S -if (minetest.get_modpath("intllib")) then - dofile(minetest.get_modpath("intllib").."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function(s) return s end -end +local S = unified_inventory.gettext -- This pair of encoding functions is used where variable text must go in -- button names, where the text might contain formspec metacharacters. @@ -63,6 +57,7 @@ function unified_inventory.get_formspec(player, page) button_row = 1 i = 1 end + local tooltip = def.tooltip or "" if def.type == "image" then formspec = formspec.."image_button[" @@ -214,7 +209,11 @@ function unified_inventory.apply_filter(player, filter, search_dir) end unified_inventory.filtered_items_list[player_name]={} for name, def in pairs(minetest.registered_items) do - if (def.groups.not_in_creative_inventory or 0) == 0 and (def.description or "") ~= "" and ffilter(name, def) then + if (def.groups.not_in_creative_inventory or 0) == 0 + and (def.description or "") ~= "" + and ffilter(name, def) + and (unified_inventory.is_creative(player_name) + or unified_inventory.crafts_for.recipe[def.name]) then table.insert(unified_inventory.filtered_items_list[player_name], name) end end diff --git a/mods/unified_inventory/register.lua b/mods/unified_inventory/register.lua index 5d4277b4..8aa32dec 100755 --- a/mods/unified_inventory/register.lua +++ b/mods/unified_inventory/register.lua @@ -1,13 +1,4 @@ -local S -if (minetest.get_modpath("intllib")) then - dofile(minetest.get_modpath("intllib").."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function(s) return s end -end - -local timers = {} -local HOME_INTERVAL = 30*60 +local S = unified_inventory.gettext minetest.register_privilege("creative", { description = "Can use the creative inventory", diff --git a/mods/unified_inventory/waypoints.lua b/mods/unified_inventory/waypoints.lua index d87bb9a2..7f91a74d 100755 --- a/mods/unified_inventory/waypoints.lua +++ b/mods/unified_inventory/waypoints.lua @@ -1,9 +1,4 @@ -local S -if intllib then - S = intllib.Getter() -else - S = function(s) return s end -end +local S = unified_inventory.gettext local hud_colors = { {"#FFFFFF", 0xFFFFFF, S("White")},