From 4f34f8b67766e1d7c3396586ee46324d2b0ad4f8 Mon Sep 17 00:00:00 2001 From: jp Date: Wed, 12 Aug 2015 22:54:26 +0200 Subject: [PATCH] xwalls : don't connect to every nodes (looks bad) --- LICENSE | 2 -- enchanting.lua | 4 +--- hive.lua | 2 +- worktable.lua | 4 +--- xwall.lua | 30 +++++++++++------------------- 5 files changed, 14 insertions(+), 28 deletions(-) diff --git a/LICENSE b/LICENSE index 7591f05..8138e69 100644 --- 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 . - -============================================================== \ No newline at end of file diff --git a/enchanting.lua b/enchanting.lua index ea371b7..f4d1a83 100644 --- a/enchanting.lua +++ b/enchanting.lua @@ -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) diff --git a/hive.lua b/hive.lua index 0d1394e..f3bde49 100644 --- 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({ diff --git a/worktable.lua b/worktable.lua index 4b30233..9ad8580 100644 --- a/worktable.lua +++ b/worktable.lua @@ -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) diff --git a/xwall.lua b/xwall.lua index 67c7954..de1fc5d 100644 --- 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