2015-02-20 15:55:03 +01:00
|
|
|
scaffolding_nodenames={"scaffolding:scaffolding"}
|
|
|
|
|
|
|
|
minetest.register_on_dignode(function(pos, node)
|
|
|
|
local i=1
|
|
|
|
while scaffolding_nodenames[i]~=nil do
|
|
|
|
if node.name==scaffolding_nodenames[i] then
|
|
|
|
np={x=pos.x, y=pos.y+1, z=pos.z}
|
|
|
|
while minetest.env:get_node(np).name==scaffolding_nodenames[i] do
|
|
|
|
minetest.env:remove_node(np)
|
|
|
|
minetest.env:add_item(np, scaffolding_nodenames[i])
|
|
|
|
np={x=np.x, y=np.y+1, z=np.z}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
i=i+1
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
iron_scaffolding_nodenames={"scaffolding:iron_scaffolding"}
|
|
|
|
|
|
|
|
minetest.register_on_dignode(function(pos, node)
|
|
|
|
local i=1
|
|
|
|
while iron_scaffolding_nodenames[i]~=nil do
|
|
|
|
if node.name==iron_scaffolding_nodenames[i] then
|
|
|
|
np={x=pos.x, y=pos.y, z=pos.z+1}
|
|
|
|
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
|
|
|
|
minetest.env:remove_node(np)
|
|
|
|
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
|
|
|
|
np={x=np.x, y=np.y, z=np.z+1}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
i=i+1
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
minetest.register_on_dignode(function(pos, node)
|
|
|
|
local i=1
|
|
|
|
while iron_scaffolding_nodenames[i]~=nil do
|
|
|
|
if node.name==iron_scaffolding_nodenames[i] then
|
|
|
|
np={x=pos.x, y=pos.y, z=pos.z-1}
|
|
|
|
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
|
|
|
|
minetest.env:remove_node(np)
|
|
|
|
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
|
|
|
|
np={x=np.x, y=np.y, z=np.z-1}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
i=i-1
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
minetest.register_on_dignode(function(pos, node)
|
|
|
|
local i=1
|
|
|
|
while iron_scaffolding_nodenames[i]~=nil do
|
|
|
|
if node.name==iron_scaffolding_nodenames[i] then
|
|
|
|
np={x=pos.x+1, y=pos.y, z=pos.z}
|
|
|
|
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
|
|
|
|
minetest.env:remove_node(np)
|
|
|
|
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
|
|
|
|
np={x=np.x+1, y=np.y, z=np.z}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
i=i+1
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
minetest.register_on_dignode(function(pos, node)
|
|
|
|
local i=1
|
|
|
|
while iron_scaffolding_nodenames[i]~=nil do
|
|
|
|
if node.name==iron_scaffolding_nodenames[i] then
|
|
|
|
np={x=pos.x-1, y=pos.y, z=pos.z}
|
|
|
|
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
|
|
|
|
minetest.env:remove_node(np)
|
|
|
|
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
|
|
|
|
np={x=np.x-1, y=np.y, z=np.z}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
i=i-1
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
-- falling nodes go into pocket --
|
|
|
|
|
2015-02-20 18:20:10 +01:00
|
|
|
function default.dig_horx(pos, node, digger)
|
2015-02-20 15:55:03 +01:00
|
|
|
if digger == nil then return end
|
2015-02-20 18:20:10 +01:00
|
|
|
local np = {x = pos.x + 1, y = pos.y, z = pos.z,}
|
|
|
|
local nn = minetest.get_node(np)
|
2015-02-20 15:55:03 +01:00
|
|
|
if nn.name == node.name then
|
|
|
|
minetest.node_dig(np, nn, digger)
|
|
|
|
end
|
|
|
|
end
|
2015-02-20 18:20:10 +01:00
|
|
|
|
|
|
|
function default.dig_horx2(pos, node, digger)
|
|
|
|
if digger == nil then return end
|
|
|
|
local np = {x = pos.x - 1, y = pos.y, z = pos.z,}
|
|
|
|
local nn = minetest.get_node(np)
|
|
|
|
if nn.name == node.name then
|
|
|
|
minetest.node_dig(np, nn, digger)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function default.dig_horz(pos, node, digger)
|
|
|
|
if digger == nil then return end
|
|
|
|
local np = {x = pos.x, y = pos.y, z = pos.z + 1,}
|
|
|
|
local nn = minetest.get_node(np)
|
|
|
|
if nn.name == node.name then
|
|
|
|
minetest.node_dig(np, nn, digger)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function default.dig_horz2(pos, node, digger)
|
|
|
|
if digger == nil then return end
|
|
|
|
local np = {x = pos.x , y = pos.y, z = pos.z - 1,}
|
|
|
|
local nn = minetest.get_node(np)
|
|
|
|
if nn.name == node.name then
|
|
|
|
minetest.node_dig(np, nn, digger)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|