Skip to content
Snippets Groups Projects
Commit 3a617bcb authored by PilzAdam's avatar PilzAdam
Browse files

Add papyrus and cactus growing

parent d5c373e2
No related branches found
No related tags found
No related merge requests found
......@@ -2043,4 +2043,59 @@ minetest.register_abm({
end,
})
--
-- Papyrus and cactus growing
--
minetest.register_abm({
nodenames = {"default:cactus"},
neighbors = {"group:sand"},
interval = 50,
chance = 20,
action = function(pos, node)
pos.y = pos.y-1
local name = minetest.env:get_node(pos).name
if minetest.get_item_group(name, "sand") ~= 0 then
pos.y = pos.y+1
local height = 0
while minetest.env:get_node(pos).name == "default:cactus" and height < 4 do
height = height+1
pos.y = pos.y+1
end
if height < 4 then
if minetest.env:get_node(pos).name == "air" then
minetest.env:set_node(pos, {name="default:cactus"})
end
end
end
end,
})
minetest.register_abm({
nodenames = {"default:papyrus"},
neighbors = {"default:dirt", "default:dirt_with_grass"},
interval = 50,
chance = 20,
action = function(pos, node)
pos.y = pos.y-1
local name = minetest.env:get_node(pos).name
if name == "default:dirt" or name == "default:dirt_with_grass" then
if minetest.env:find_node_near(pos, 3, {"group:water"}) == nil then
return
end
pos.y = pos.y+1
local height = 0
while minetest.env:get_node(pos).name == "default:papyrus" and height < 4 do
height = height+1
pos.y = pos.y+1
end
if height < 4 then
if minetest.env:get_node(pos).name == "air" then
minetest.env:set_node(pos, {name="default:papyrus"})
end
end
end
end,
})
-- END
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment