default:bush_stem
default:bush_leaves
+default:bush_sapling
default:acacia_bush_stem
default:acacia_bush_leaves
+default:acacia_bush_sapling
Corals
------
tiles = {"default_leaves_simple.png"},
paramtype = "light",
groups = {snappy = 3, flammable = 2, leaves = 1},
+ drop = {
+ max_items = 1,
+ items = {
+ {items = {"default:bush_sapling"}, rarity = 5},
+ {items = {"default:bush_leaves"}}
+ }
+ },
sounds = default.node_sound_leaves_defaults(),
after_place_node = default.after_place_leaves,
})
+minetest.register_node("default:bush_sapling", {
+ description = "Bush Sapling",
+ drawtype = "plantlike",
+ tiles = {"default_bush_sapling.png"},
+ inventory_image = "default_bush_sapling.png",
+ wield_image = "default_bush_sapling.png",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ on_timer = default.grow_sapling,
+ selection_box = {
+ type = "fixed",
+ fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16}
+ },
+ groups = {snappy = 2, dig_immediate = 3, flammable = 2,
+ attached_node = 1, sapling = 1},
+ sounds = default.node_sound_leaves_defaults(),
+
+ on_construct = function(pos)
+ minetest.get_node_timer(pos):start(math.random(1200, 2400))
+ end,
+
+ on_place = function(itemstack, placer, pointed_thing)
+ itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
+ "default:bush_sapling",
+ -- minp, maxp to be checked, relative to sapling pos
+ {x = -1, y = 0, z = -1},
+ {x = 1, y = 1, z = 1},
+ -- maximum interval of interior volume check
+ 2)
+
+ return itemstack
+ end,
+})
+
minetest.register_node("default:acacia_bush_stem", {
description = "Acacia Bush Stem",
drawtype = "plantlike",
tiles = {"default_acacia_leaves_simple.png"},
paramtype = "light",
groups = {snappy = 3, flammable = 2, leaves = 1},
+ drop = {
+ max_items = 1,
+ items = {
+ {items = {"default:acacia_bush_sapling"}, rarity = 5},
+ {items = {"default:acacia_bush_leaves"}}
+ }
+ },
sounds = default.node_sound_leaves_defaults(),
after_place_node = default.after_place_leaves,
})
+minetest.register_node("default:acacia_bush_sapling", {
+ description = "Acacia Bush Sapling",
+ drawtype = "plantlike",
+ tiles = {"default_acacia_bush_sapling.png"},
+ inventory_image = "default_acacia_bush_sapling.png",
+ wield_image = "default_acacia_bush_sapling.png",
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ on_timer = default.grow_sapling,
+ selection_box = {
+ type = "fixed",
+ fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 2 / 16, 3 / 16}
+ },
+ groups = {snappy = 2, dig_immediate = 3, flammable = 2,
+ attached_node = 1, sapling = 1},
+ sounds = default.node_sound_leaves_defaults(),
+
+ on_construct = function(pos)
+ minetest.get_node_timer(pos):start(math.random(1200, 2400))
+ end,
+
+ on_place = function(itemstack, placer, pointed_thing)
+ itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
+ "default:acacia_bush_sapling",
+ -- minp, maxp to be checked, relative to sapling pos
+ {x = -1, y = 0, z = -1},
+ {x = 1, y = 1, z = 1},
+ -- maximum interval of interior volume check
+ 2)
+
+ return itemstack
+ end,
+})
+
--
-- Corals
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
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
--