mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-03-15 12:21:24 +00:00
Make papyrus and cacti collapse
This commit is contained in:
parent
9232734a48
commit
dfccdb3e06
1 changed files with 19 additions and 1 deletions
|
@ -961,7 +961,7 @@ minetest.register_node("default:papyrus", {
|
|||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
|
||||
},
|
||||
groups = {snappy=3,flammable=2},
|
||||
groups = {snappy=3,flammable=2,plant_falling=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
|
@ -1702,6 +1702,24 @@ minetest.register_craftitem("default:scorched_stuff", {
|
|||
inventory_image = "default_scorched_stuff.png",
|
||||
})
|
||||
|
||||
-- Nodes in the group plant_falling drop themselves if the node below is removed
|
||||
minetest.register_on_dignode(function(pos, node)
|
||||
local np = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
local nn = minetest.env:get_node(np)
|
||||
while minetest.get_item_group(nn.name, "plant_falling") > 0 do
|
||||
minetest.env:remove_node(np)
|
||||
local itempos = {
|
||||
x = np.x + math.random(60)/60-0.3,
|
||||
y = np.y + math.random(60)/60-0.3,
|
||||
z = np.z + math.random(60)/60-0.3
|
||||
}
|
||||
minetest.env:add_item(itempos, nn.name)
|
||||
np = {x = np.x, y = np.y + 1, z = np.z}
|
||||
nn = minetest.env:get_node(np)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
-- Support old code
|
||||
function default.spawn_falling_node(p, nodename)
|
||||
spawn_falling_node(p, nodename)
|
||||
|
|
Loading…
Add table
Reference in a new issue