summaryrefslogtreecommitdiff
path: root/papyrus.lua
diff options
context:
space:
mode:
Diffstat (limited to 'papyrus.lua')
-rw-r--r--papyrus.lua24
1 files changed, 19 insertions, 5 deletions
diff --git a/papyrus.lua b/papyrus.lua
index 281e149..8fb2232 100644
--- a/papyrus.lua
+++ b/papyrus.lua
@@ -1,7 +1,7 @@
-- override default papyrus to make it walkable
minetest.override_item("default:papyrus", {walkable = true, sunlight_propagates = true})
--- have papyrus grow up to 4 high and bamboo grow up to 5 in height (shared abm)
+-- have papyrus grow up to 4 high and bamboo grow up to 8 in height (shared abm)
minetest.register_abm({
nodenames = {"default:papyrus", "ethereal:bamboo"},
neighbors = {"group:soil"},
@@ -9,6 +9,7 @@ minetest.register_abm({
chance = 20,
action = function(pos, node)
+ local oripos = pos.y
local high = 4
pos.y = pos.y - 1
@@ -21,20 +22,33 @@ minetest.register_abm({
end
if node.name == "ethereal:bamboo" then
- high = 5
+ high = 8 -- was 5
end
pos.y = pos.y + 1
local height = 0
- while minetest.get_node(pos).name == node.name and height < high do
+ while height < high
+ and minetest.get_node(pos).name == node.name do
height = height + 1
pos.y = pos.y + 1
end
nod = minetest.get_node_or_nil(pos)
- if nod and nod.name == "air" and height < high then
- minetest.set_node(pos, {name = node.name})
+
+ if nod
+ and nod.name == "air"
+ and height < high then
+ if node.name == "ethereal:bamboo"
+ and height == (high - 1) then
+ ethereal.add_tree({
+ x = pos.x,
+ y = oripos,
+ z = pos.z
+ }, 1, 1, ethereal.bambootree)
+ else
+ minetest.set_node(pos, {name = node.name})
+ end
end
end,