1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-23 07:10:19 +01:00

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:
paramat 2017-04-12 09:25:21 +01:00
parent d68d2c08ef
commit a57d2db54a
7 changed files with 140 additions and 3 deletions

View File

@ -766,14 +766,20 @@ Trees
* `default.grow_new_pine_tree(pos)` * `default.grow_new_pine_tree(pos)`
* Grows a new design pine tree at pos * Grows a new design pine tree at pos
* `default.grow_new_snowy_pine_tree(pos)`
* Grows a new design snowy pine tree at pos
* `default.grow_new_acacia_tree(pos)` * `default.grow_new_acacia_tree(pos)`
* Grows a new design acacia tree at pos * Grows a new design acacia tree at pos
* `default.grow_new_aspen_tree(pos)` * `default.grow_new_aspen_tree(pos)`
* Grows a new design aspen tree at pos * Grows a new design aspen tree at pos
* `default.grow_new_snowy_pine_tree(pos)` * `default.grow_bush(pos)`
* Grows a new design snowy pine tree at pos * Grows a bush at pos
* `default.grow_acacia_bush(pos)`
* Grows an acaia bush at pos
Carts Carts
----- -----

View File

@ -17,6 +17,7 @@ Cisoun's texture pack (CC BY-SA 3.0):
default_lava.png default_lava.png
default_leaves.png default_leaves.png
default_sapling.png default_sapling.png
default_bush_sapling.png
default_stone.png default_stone.png
default_tree.png default_tree.png
default_tree_top.png default_tree_top.png
@ -90,6 +91,7 @@ paramat (CC BY-SA 3.0):
default_acacia_leaves.png default_acacia_leaves.png
default_acacia_leaves_simple.png default_acacia_leaves_simple.png
default_acacia_sapling.png default_acacia_sapling.png
default_acacia_bush_sapling.png
default_acacia_tree.png default_acacia_tree.png
default_acacia_tree_top.png default_acacia_tree_top.png
default_acacia_wood.png default_acacia_wood.png
@ -126,7 +128,7 @@ brunob.santos (CC BY-SA 4.0):
default_desert_cobble.png default_desert_cobble.png
BlockMen (CC BY-SA 3.0): BlockMen (CC BY-SA 3.0):
default_aspen_leaves.png default_aspen_leaves.png -- Derived from Sofar's texture
default_wood.png default_wood.png
default_clay_brick.png default_clay_brick.png
default_iron_ingot.png default_iron_ingot.png

View File

@ -966,6 +966,18 @@ minetest.register_craft({
burntime = 10, burntime = 10,
}) })
minetest.register_craft({
type = "fuel",
recipe = "default:bush_sapling",
burntime = 6,
})
minetest.register_craft({
type = "fuel",
recipe = "default:acacia_bush_sapling",
burntime = 7,
})
minetest.register_craft({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "default:aspen_sapling", recipe = "default:aspen_sapling",

View File

@ -140,8 +140,10 @@ default:dry_grass_5
default:bush_stem default:bush_stem
default:bush_leaves default:bush_leaves
default:bush_sapling
default:acacia_bush_stem default:acacia_bush_stem
default:acacia_bush_leaves default:acacia_bush_leaves
default:acacia_bush_sapling
Corals Corals
------ ------
@ -1307,11 +1309,53 @@ minetest.register_node("default:bush_leaves", {
tiles = {"default_leaves_simple.png"}, tiles = {"default_leaves_simple.png"},
paramtype = "light", paramtype = "light",
groups = {snappy = 3, flammable = 2, leaves = 1}, 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(), sounds = default.node_sound_leaves_defaults(),
after_place_node = default.after_place_leaves, 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", { minetest.register_node("default:acacia_bush_stem", {
description = "Acacia Bush Stem", description = "Acacia Bush Stem",
drawtype = "plantlike", drawtype = "plantlike",
@ -1336,11 +1380,53 @@ minetest.register_node("default:acacia_bush_leaves", {
tiles = {"default_acacia_leaves_simple.png"}, tiles = {"default_acacia_leaves_simple.png"},
paramtype = "light", paramtype = "light",
groups = {snappy = 3, flammable = 2, leaves = 1}, 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(), sounds = default.node_sound_leaves_defaults(),
after_place_node = default.after_place_leaves, 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 -- Corals

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

View File

@ -77,6 +77,14 @@ function default.grow_sapling(pos)
minetest.log("action", "An aspen sapling grows into a tree at ".. minetest.log("action", "An aspen sapling grows into a tree at "..
minetest.pos_to_string(pos)) minetest.pos_to_string(pos))
default.grow_new_aspen_tree(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 end
@ -426,6 +434,29 @@ function default.grow_new_aspen_tree(pos)
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 -- Sapling 'on place' function to check protection of node and resulting tree volume
-- --