]> git.lizzy.rs Git - xdecor.git/commitdiff
Craft guide : remember tab id on clearing filter
authorkilbith <jeanpatrick.guerrero@gmail.com>
Thu, 14 Jan 2016 22:29:31 +0000 (23:29 +0100)
committerkilbith <jeanpatrick.guerrero@gmail.com>
Thu, 14 Jan 2016 22:47:55 +0000 (23:47 +0100)
enchanting.lua
worktable.lua

index df7961db9bd3b4a703cfb25031b4739cc04c8241..4822c1ae6a81d60067261f6cff3d53ea47bdf146 100644 (file)
@@ -75,9 +75,7 @@ end
 
 local function allowed(tool)
        for item in pairs(minetest.registered_tools) do
-               if item:match("enchanted_"..tool) then
-                       return true
-               end
+               if item:match("enchanted_"..tool) then return true end
        end
        return false
 end
index 8b3643cbbde1ac756c2ddc8e38d72390182dd68c..4a44b592ec3ef5770ce9255517fdb4cbc25bf9ae 100644 (file)
@@ -227,8 +227,8 @@ function worktable.fields(pos, _, fields)
        elseif fields.storage then
                worktable.formspecs.storage(meta)
        elseif fields.craftguide or fields.clearfilter then
-               worktable.craftguide_main_list(meta, nil, 1)
-               worktable.craftguide_formspec(meta, 1, nil, 1, "", 1)
+               worktable.craftguide_main_list(meta, nil, tab_id)
+               worktable.craftguide_formspec(meta, 1, nil, 1, "", tab_id)
        elseif fields.alternate then
                local item = formspec:match("item_image%[.*;([%w_:]+)%]") or ""
                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")
 end
 
-function worktable.allowed(table, element)
-       if table then
-               for _, value in pairs(table) do
-                       if value == element then
-                               return true
-                       end
-               end
+function worktable.allowed(mod, node)
+       if not mod then return end
+       for _, it in pairs(mod) do
+               if it == node then return true end
        end
        return false
 end