]> git.lizzy.rs Git - xdecor.git/commitdiff
xwalls : don't connect to every nodes (looks bad)
authorjp <jeanpatrick.guerrero@gmail.com>
Wed, 12 Aug 2015 20:54:26 +0000 (22:54 +0200)
committerjp <jeanpatrick.guerrero@gmail.com>
Wed, 12 Aug 2015 21:38:10 +0000 (23:38 +0200)
LICENSE
enchanting.lua
hive.lua
worktable.lua
xwall.lua

diff --git a/LICENSE b/LICENSE
index 7591f05a02dc7bc24a47bcd0445106fdb3af3f29..8138e69bd8f559151c3ac0257bd04237ff4c02b6 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -684,5 +684,3 @@ may consider it more useful to permit linking proprietary applications with
 the library.  If this is what you want to do, use the GNU Lesser General
 Public License instead of this License.  But first, please read
 <http://www.gnu.org/philosophy/why-not-lgpl.html>.
-
-==============================================================
\ No newline at end of file
index ea371b7bd1878fc97bed954632ce84c252baeb66..f4d1a83debb025235438ea64a232b97b605d69c8 100644 (file)
@@ -70,8 +70,6 @@ function enchanting.put(_, listname, _, stack, _)
        return count
 end
 
-function enchanting.move(_, _, _, _, _, _, _) return 0 end
-
 xdecor.register("enchantment_table", {
        description = "Enchantment Table",
        tiles = {
@@ -85,7 +83,7 @@ xdecor.register("enchantment_table", {
        on_construct = enchanting.construct,
        on_receive_fields = enchanting.fields,
        allow_metadata_inventory_put = enchanting.put,
-       allow_metadata_inventory_move = enchanting.move
+       allow_metadata_inventory_move = function(_,_,_,_,_,_,_) return 0 end
 })
 
 function enchanting.register_enchtools(init, m, def)
index 0d1394ec8e712cd70382e1556f25a4c1cb6dfcc3..f3bde490325e4c052d7d6686d51306b881d08a41 100644 (file)
--- a/hive.lua
+++ b/hive.lua
@@ -39,7 +39,7 @@ xdecor.register("hive", {
        allow_metadata_inventory_put = function(_, listname, _, stack, _)
                if listname == "honey" then return 0 end
                return stack:get_count()
-       end,
+       end
 })
 
 minetest.register_abm({
index 4b30233fa266ad77606e19ddb652cd5fa43fa53c..9ad85809a929dfc7b83f3421d5b17225b02e6f53 100644 (file)
@@ -115,8 +115,6 @@ function worktable.put(_, listname, _, stack, _)
        return count
 end
 
-function worktable.move(_, _, _, _, _, _, _) return 0 end
-
 xdecor.register("worktable", {
        description = "Work Table",
        groups = {cracky=2, choppy=2},
@@ -130,7 +128,7 @@ xdecor.register("worktable", {
        on_construct = worktable.construct,
        on_receive_fields = worktable.fields,
        allow_metadata_inventory_put = worktable.put,
-       allow_metadata_inventory_move = worktable.move
+       allow_metadata_inventory_move = function(_,_,_,_,_,_,_) return 0 end
 })
 
 local function description(m, w)
index 67c795498d5c4f2e34fceb2d24e55df138bf1131..de1fc5d10625d5ca19c6f005bc0593332c70d44b 100644 (file)
--- a/xwall.lua
+++ b/xwall.lua
@@ -48,15 +48,10 @@ function xwall.update_one_node(pos, name, digged)
                local node = minetest.get_node(vector.add(pos, dir))
                local ndef = minetest.registered_nodes[node.name]
 
-               if node and node.name and ndef then
-                       if ndef.drop == name or (ndef.groups and ndef.groups.xwall) then
-                               candidates[i] = node.name
-                               id = id + pow2[i]
-                       end
-                       if ndef.walkable ~= false and ndef.drawtype ~= "nodebox" then
-                               candidates[i] = 0
-                               id = id + pow2[i]
-                       end
+               if not node and not node.name and not ndef then break end
+               if ndef.drop == name or (ndef.groups and ndef.groups.xwall) then
+                       candidates[i] = node.name
+                       id = id + pow2[i]
                end
        end
 
@@ -73,6 +68,7 @@ function xwall.update_one_node(pos, name, digged)
                        minetest.swap_node(pos, {name=name, param2=0})
                end
        end
+
        return candidates
 end
 
@@ -82,9 +78,8 @@ function xwall.update(pos, name, active, has_been_digged)
        local c = xwall.update_one_node(pos, name, has_been_digged)
        for j = 1, #directions do
                local dir2 = directions[j]
-               if c[j] ~= 0 and c[j] ~= "ignore" then
-                       xwall.update_one_node(vector.add(pos, dir2), c[j], false)
-               end
+               if c[j] == 0 and c[j] == "ignore" then break end
+               xwall.update_one_node(vector.add(pos, dir2), c[j], false)
        end
 end
 
@@ -96,23 +91,20 @@ function xwall.register(name, def, node_box_data)
                def.drop = name.."_ln"
                def.node_box = {type = "fixed", fixed = node_box_data[k]}
 
-               if not def.tiles then
-                       def.tiles = def.textures
-               end
+               if not def.tiles then def.tiles = def.textures end
                if not def.groups then
                        def.groups = {xwall=1, cracky=3}
-               else
-                       def.groups.xwall = 1
                end
+               def.groups.xwall = 1
 
                local newdef = clone_table(def)
                if k == "ln" then
                        newdef.on_construct = function(pos)
                                return xwall.update(pos, name.."_ln", true, nil)
                        end
-               else
-                       newdef.groups.not_in_creative_inventory = 1
                end
+               newdef.groups.not_in_creative_inventory = 1
+
                newdef.after_dig_node = function(pos, _, _, _)
                        return xwall.update(pos, name.."_ln", true, true)
                end