]> git.lizzy.rs Git - xdecor.git/commitdiff
Small simplifications
authorkilbith <jeanpatrick.guerrero@gmail.com>
Mon, 11 Jan 2016 18:51:02 +0000 (19:51 +0100)
committerkilbith <jeanpatrick.guerrero@gmail.com>
Mon, 11 Jan 2016 19:12:17 +0000 (20:12 +0100)
cooking.lua
enchanting.lua
worktable.lua

index 5093abb03e39ea7776bac73a898af2a0f10698fb..c35bcd099d443b81f3e492057c33f6814641977c 100644 (file)
@@ -111,7 +111,7 @@ minetest.register_abm({
 
 minetest.register_abm({
        nodenames = {"xdecor:cauldron_boiling_water"},
-       interval = 3, chance = 1,
+       interval = 5, chance = 1,
        action = function(pos, node)
                local objs = minetest.get_objects_inside_radius(pos, 0.5)
                if not objs then return end
@@ -124,7 +124,7 @@ minetest.register_abm({
 
                for _, obj in pairs(objs) do
                        if obj and obj:get_luaentity() then
-                               local itemstring = obj:get_luaentity().itemstring:match(":([%w_]+)")
+                               local itemstring = obj:get_luaentity().itemstring:match("[^:]+$")
                                if not next(ingredients) then
                                        for _, rep in pairs(ingredients) do
                                                if itemstring == rep then return end
index bfa4549d231f936a8088ac967bdf06f848338759..b6c10a5ff387c82a7c896adc42f1c88221f071c7 100644 (file)
@@ -83,7 +83,7 @@ local function allowed(tool)
 end
 
 function enchanting.put(_, listname, _, stack)
-       local item = stack:get_name():match(":([%w_]+)")
+       local item = stack:get_name():match("[^:]+$")
        if listname == "mese" and item == "mese_crystal" then
                return stack:get_count()
        elseif listname == "tool" and allowed(item) then
index 83740e889960eda5030f78d4688b3729b201a643..bd59cd7681203e00d5d6a06dfd904124cdbbda5c 100644 (file)
@@ -34,17 +34,15 @@ local def = { -- Nodebox name, yield, definition.
 function worktable.get_recipe(item)
        if item:find("^group:") then
                if item:find("wool$") or item:find("dye$") then
-                       item = item:match(":([%w_]+)")..":white"
-               elseif minetest.registered_items["default:"..item:match(":([%w_,]+)")] then
+                       item = item:match("[^,:]+$")..":white"
+               elseif minetest.registered_items["default:"..item:match("[^,:]+$")] then
                        item = item:gsub("group:", "default:")
                else
                        for node, definition in pairs(minetest.registered_items) do
-                       for group in pairs(definition.groups) do
-                               if item:match(".*"..group.."$") then
+                               if definition.groups[item:match("[^,:]+$")] then
                                        item = node
                                end
                        end
-                       end
                end
        end
        return item
@@ -274,9 +272,9 @@ function worktable.put(_, listname, _, stack)
        local stackname = stack:get_name()
        local mod, node = stackname:match("([%w_]+):([%w_]+)")
 
-       if (listname == "input" and worktable.contains(nodes[mod], node)) or
+       if (listname == "tool" and stack:get_wear() > 0 and stackname ~= "xdecor:hammer") or
+                       (listname == "input" and worktable.contains(nodes[mod], node)) or
                        (listname == "hammer" and stackname == "xdecor:hammer") or
-                       (listname == "tool" and stack:get_wear() > 0) or
                        listname == "storage" then
                return stack:get_count()
        end