2015-04-10 17:38:53 +03:00
|
|
|
-- override default papyrus to make it walkable
|
2014-11-09 22:17:41 +03:00
|
|
|
minetest.override_item("default:papyrus", {walkable=true, sunlight_propagates=true})
|
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
-- have papyrus grow up to 4 high and bamboo grow up to 5 in height (shared abm)
|
2014-11-09 22:17:41 +03:00
|
|
|
minetest.register_abm({
|
|
|
|
nodenames = {"default:papyrus", "ethereal:bamboo"},
|
|
|
|
neighbors = {"group:soil"},
|
|
|
|
interval = 50,
|
|
|
|
chance = 20,
|
|
|
|
action = function(pos, node)
|
|
|
|
|
|
|
|
local high = 4
|
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
pos.y = pos.y - 1
|
|
|
|
local nod = minetest.get_node_or_nil(pos)
|
2014-11-09 22:17:41 +03:00
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
if not nod
|
|
|
|
or minetest.get_item_group(nod.name, "soil") < 1
|
|
|
|
or minetest.find_node_near(pos, 3, {"group:water"}) == nil then
|
2014-11-09 22:17:41 +03:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
if node.name == "ethereal:bamboo" then
|
2014-11-09 22:17:41 +03:00
|
|
|
high = 5
|
|
|
|
end
|
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
pos.y = pos.y + 1
|
2014-11-09 22:17:41 +03:00
|
|
|
local height = 0
|
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
while minetest.get_node(pos).name == node.name and height < high do
|
|
|
|
height = height + 1
|
|
|
|
pos.y = pos.y + 1
|
2014-11-09 22:17:41 +03:00
|
|
|
end
|
|
|
|
|
2015-04-10 17:38:53 +03:00
|
|
|
nod = minetest.get_node_or_nil(pos)
|
|
|
|
if nod and nod.name == "air" and height < high then
|
|
|
|
minetest.set_node(pos, {name=node.name})
|
2014-11-09 22:17:41 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
end,
|
|
|
|
})
|