0
0
Fork 0

Drop sugar canes when dirt/etc. below was dug

This commit is contained in:
Wuzzy 2017-08-22 17:14:27 +02:00
parent d7b2f8370e
commit 058049897c
1 changed files with 6 additions and 10 deletions

View File

@ -188,7 +188,7 @@ minetest.register_abm({
}) })
-- --
-- Papyrus and cactus drop -- Sugar canes drop
-- --
local timber_nodenames={"mcl_core:reeds"} local timber_nodenames={"mcl_core:reeds"}
@ -196,16 +196,12 @@ local timber_nodenames={"mcl_core:reeds"}
minetest.register_on_dignode(function(pos, node) minetest.register_on_dignode(function(pos, node)
local i=1 local i=1
while timber_nodenames[i]~=nil do while timber_nodenames[i]~=nil do
if node.name==timber_nodenames[i] then
local np={x=pos.x, y=pos.y+1, z=pos.z} local np={x=pos.x, y=pos.y+1, z=pos.z}
while minetest.get_node(np).name==timber_nodenames[i] do while minetest.get_node(np).name==timber_nodenames[i] do
minetest.remove_node(np) minetest.remove_node(np)
if not minetest.settings:get_bool("creative_mode") then
minetest.add_item(np, timber_nodenames[i]) minetest.add_item(np, timber_nodenames[i])
end
np={x=np.x, y=np.y+1, z=np.z} np={x=np.x, y=np.y+1, z=np.z}
end end
end
i=i+1 i=i+1
end end
end) end)