]> git.lizzy.rs Git - xdecor.git/blobdiff - workbench.lua
Don't crash on nil-player in can_dig and check the right players for attachment in...
[xdecor.git] / workbench.lua
index fee0bd953f0c473cdbdae9c09e9132c6284c4c1f..ccf1918cb95f7f135174780c1b80501ae5d1f9de 100644 (file)
@@ -5,14 +5,19 @@ screwdriver = screwdriver or {}
 -- Only the regular, solid blocks without metas or explosivity can be cut.
 local nodes = {}
 for node, def in pairs(minetest.registered_nodes) do
-       if (def.drawtype == "normal" or def.drawtype:find("glass")) and
-          (def.groups.cracky or def.groups.choppy) and not
-          def.on_construct and not def.after_place_node and not
-          def.after_place_node and not def.on_rightclick and not
-          def.on_blast and not def.allow_metadata_inventory_take and not
-          (def.groups.not_in_creative_inventory == 1) and not
-          def.groups.wool and not def.description:find("Ore") and
-          def.description and def.description ~= "" and def.light_source == 0
+       if (def.drawtype == "normal" or def.drawtype:sub(1,5) == "glass") and
+          (def.groups.cracky or def.groups.choppy) and
+          not def.on_construct and
+          not def.after_place_node and
+          not def.on_rightclick and
+          not def.on_blast and
+          not def.allow_metadata_inventory_take and
+          not (def.groups.not_in_creative_inventory == 1) and
+          not def.groups.wool and
+          not def.description:find("Ore") and
+          def.description and
+          def.description ~= "" and
+          def.light_source == 0
        then
                nodes[#nodes+1] = node
        end
@@ -166,8 +171,8 @@ function workbench.take(_, listname, _, stack, player)
        return stack:get_count()
 end
 
-function workbench.move(_, _, _, to_list, _, count)
-       if to_list == "storage" then return count end
+function workbench.move(_, from_list, _, to_list, _, count)
+       if to_list == "storage" and from_list ~= "forms" then return count end
        return 0
 end
 
@@ -224,7 +229,8 @@ for i = 1, #nodes do
        local def = minetest.registered_nodes[node]
 
        if d[3] then
-               local groups, tiles = {}, {}
+               local groups = {}
+               local tiles
                groups.not_in_creative_inventory = 1
 
                for k, v in pairs(def.groups) do