xwalls : don't connect to every nodes (looks bad)

This commit is contained in:
jp 2015-08-12 22:54:26 +02:00
parent c2022f7b41
commit 4f34f8b677
5 changed files with 14 additions and 28 deletions

View File

@ -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>.
==============================================================

View 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)

View File

@ -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({

View 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)

View File

@ -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