Bushes: Add saplings
Bush saplings grow in half the time of tree saplings. Bushes do not need 'from sapling' schematic variants because only the stem node is force-placed in the mapgen schematic, so only the sapling is force-replaced. Bush leaves drop saplings with a rarity that ensures at least 1 sapling per bush on average.
This commit is contained in:
parent
d68d2c08ef
commit
a57d2db54a
7 changed files with 140 additions and 3 deletions
|
@ -77,6 +77,14 @@ function default.grow_sapling(pos)
|
|||
minetest.log("action", "An aspen sapling grows into a tree at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_new_aspen_tree(pos)
|
||||
elseif node.name == "default:bush_sapling" then
|
||||
minetest.log("action", "A bush sapling grows into a bush at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_bush(pos)
|
||||
elseif node.name == "default:acacia_bush_sapling" then
|
||||
minetest.log("action", "An acacia bush sapling grows into a bush at "..
|
||||
minetest.pos_to_string(pos))
|
||||
default.grow_acacia_bush(pos)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -426,6 +434,29 @@ function default.grow_new_aspen_tree(pos)
|
|||
end
|
||||
|
||||
|
||||
-- Bushes do not need 'from sapling' schematic variants because
|
||||
-- only the stem node is force-placed in the schematic.
|
||||
|
||||
-- Bush
|
||||
|
||||
function default.grow_bush(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/bush.mts"
|
||||
minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
|
||||
path, "0", nil, false)
|
||||
end
|
||||
|
||||
|
||||
-- Acacia bush
|
||||
|
||||
function default.grow_acacia_bush(pos)
|
||||
local path = minetest.get_modpath("default") ..
|
||||
"/schematics/acacia_bush.mts"
|
||||
minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
|
||||
path, "0", nil, false)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Sapling 'on place' function to check protection of node and resulting tree volume
|
||||
--
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue