From 235be08236318a1bf5b3bdedfd5e1c00994b1bc3 Mon Sep 17 00:00:00 2001 From: Kotolegokot Date: Thu, 1 Nov 2012 15:23:00 +0600 Subject: [PATCH] Cactus and papyrus are dropping nodes --- mods/default/init.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mods/default/init.lua b/mods/default/init.lua index 3fe693d..223e97c 100644 --- a/mods/default/init.lua +++ b/mods/default/init.lua @@ -501,7 +501,7 @@ minetest.register_node("default:cactus", { description = "Cactus", tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"}, is_ground_content = true, - groups = {snappy=2,choppy=3,flammable=2,falling_node=1}, + groups = {snappy=2,choppy=3,flammable=2,dropping_node=1}, sounds = default.node_sound_wood_defaults(), }) @@ -514,7 +514,7 @@ minetest.register_node("default:papyrus", { paramtype = "light", is_ground_content = true, walkable = false, - groups = {snappy=3,flammable=2}, + groups = {snappy=3,flammable=2, dropping_node=1}, sounds = default.node_sound_leaves_defaults(), }) @@ -1114,6 +1114,15 @@ function nodeupdate_single(p) nodeupdate(p) end end + if minetest.get_node_group(n.name, "dropping_node") ~= 0 then + p_bottom = {x=p.x, y=p.y-1, z=p.z} + n_bottom = minetest.env:get_node(p_bottom) + if not minetest.registered_nodes[n_bottom.name].walkable and n_bottom.name ~= n.name then + minetest.env:remove_node(p) + minetest.env:add_item(p, n.name) + nodeupdate(p) + end + end end function nodeupdate(p)