Craft guide : remember tab id on clearing filter

This commit is contained in:
kilbith 2016-01-14 23:29:31 +01:00
parent 84387d0ea3
commit a9f7433965
2 changed files with 7 additions and 12 deletions

View File

@ -75,9 +75,7 @@ end
local function allowed(tool) local function allowed(tool)
for item in pairs(minetest.registered_tools) do for item in pairs(minetest.registered_tools) do
if item:match("enchanted_"..tool) then if item:match("enchanted_"..tool) then return true end
return true
end
end end
return false return false
end end

View File

@ -227,8 +227,8 @@ function worktable.fields(pos, _, fields)
elseif fields.storage then elseif fields.storage then
worktable.formspecs.storage(meta) worktable.formspecs.storage(meta)
elseif fields.craftguide or fields.clearfilter then elseif fields.craftguide or fields.clearfilter then
worktable.craftguide_main_list(meta, nil, 1) worktable.craftguide_main_list(meta, nil, tab_id)
worktable.craftguide_formspec(meta, 1, nil, 1, "", 1) worktable.craftguide_formspec(meta, 1, nil, 1, "", tab_id)
elseif fields.alternate then elseif fields.alternate then
local item = formspec:match("item_image%[.*;([%w_:]+)%]") or "" local item = formspec:match("item_image%[.*;([%w_:]+)%]") or ""
local recipe_num = tonumber(formspec:match("Recipe%s(%d+)")) or 1 local recipe_num = tonumber(formspec:match("Recipe%s(%d+)")) or 1
@ -262,13 +262,10 @@ function worktable.dig(pos)
inv:is_empty("tool") and inv:is_empty("storage") inv:is_empty("tool") and inv:is_empty("storage")
end end
function worktable.allowed(table, element) function worktable.allowed(mod, node)
if table then if not mod then return end
for _, value in pairs(table) do for _, it in pairs(mod) do
if value == element then if it == node then return true end
return true
end
end
end end
return false return false
end end