From 9318c71659df9c80653b71a438303ac43107f9c7 Mon Sep 17 00:00:00 2001 From: TumeniNodes Date: Thu, 12 Jul 2018 20:17:07 -0400 Subject: [PATCH] Biomes: Add pine bush to taiga and snowy grassland Replaces 'bush' in snowy grassland. --- game_api.txt | 3 + mods/default/README.txt | 2 + mods/default/crafting.lua | 19 +++++ mods/default/mapgen.lua | 26 +++++- mods/default/nodes.lua | 80 ++++++++++++++++++ mods/default/schematics/pine_bush.mts | Bin 0 -> 111 bytes .../textures/default_pine_bush_sapling.png | Bin 0 -> 166 bytes .../textures/default_pine_bush_stem.png | Bin 0 -> 280 bytes mods/default/trees.lua | 14 +++ 9 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 mods/default/schematics/pine_bush.mts create mode 100644 mods/default/textures/default_pine_bush_sapling.png create mode 100644 mods/default/textures/default_pine_bush_stem.png diff --git a/game_api.txt b/game_api.txt index 90594e8f..97ee3caa 100644 --- a/game_api.txt +++ b/game_api.txt @@ -918,6 +918,9 @@ Trees * `default.grow_acacia_bush(pos)` * Grows an acaia bush at pos + + * `default.grow_pine_bush(pos)` + * Grows a pine bush at pos Carts ----- diff --git a/mods/default/README.txt b/mods/default/README.txt index 87e0d31c..e3efdd20 100644 --- a/mods/default/README.txt +++ b/mods/default/README.txt @@ -79,11 +79,13 @@ paramat (CC BY-SA 3.0): default_acacia_leaves_simple.png default_acacia_sapling.png default_acacia_bush_sapling.png + default_pine_bush_sapling.png default_acacia_tree.png default_acacia_tree_top.png default_acacia_wood.png default_acacia_bush_stem.png default_bush_stem.png + default_pine_bush_stem.png default_junglewood.png default_jungletree_top.png default_sandstone_brick.png diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua index c0f2252f..b8651c0c 100644 --- a/mods/default/crafting.lua +++ b/mods/default/crafting.lua @@ -49,6 +49,13 @@ minetest.register_craft({ } }) +minetest.register_craft({ + output = "default:pine_wood", + recipe = { + {"default:pine_bush_stem"}, + } +}) + minetest.register_craft({ output = 'default:stick 4', recipe = { @@ -953,6 +960,12 @@ minetest.register_craft({ burntime = 4, }) +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_bush_sapling", + burntime = 2, +}) + minetest.register_craft({ type = "fuel", recipe = "default:aspen_sapling", @@ -1058,6 +1071,12 @@ minetest.register_craft({ burntime = 8, }) +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_bush_stem", + burntime = 6, +}) + minetest.register_craft({ type = "fuel", recipe = "default:junglegrass", diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua index fdbe4a83..f0da5d5a 100644 --- a/mods/default/mapgen.lua +++ b/mods/default/mapgen.lua @@ -1946,7 +1946,7 @@ function default.register_decorations() minetest.register_decoration({ name = "default:bush", deco_type = "schematic", - place_on = {"default:dirt_with_grass", "default:dirt_with_snow"}, + place_on = {"default:dirt_with_grass"}, sidelen = 16, noise_params = { offset = -0.004, @@ -1956,7 +1956,7 @@ function default.register_decorations() octaves = 3, persist = 0.7, }, - biomes = {"snowy_grassland", "grassland", "deciduous_forest", + biomes = {"grassland", "deciduous_forest", "floatland_grassland"}, y_max = 31000, y_min = 1, @@ -1986,6 +1986,28 @@ function default.register_decorations() flags = "place_center_x, place_center_z", }) + -- Pine bush + + minetest.register_decoration({ + name = "default:pine_bush", + deco_type = "schematic", + place_on = {"default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 137, + octaves = 3, + persist = 0.7, + }, + biomes = {"taiga", "snowy_grassland"}, + y_max = 31000, + y_min = 4, + schematic = minetest.get_modpath("default") .. "/schematics/pine_bush.mts", + flags = "place_center_x, place_center_z", + }) + -- Grasses register_grass_decoration(-0.03, 0.09, 5) diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 13a4c0bf..4f427f43 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -162,6 +162,9 @@ default:bush_sapling default:acacia_bush_stem default:acacia_bush_leaves default:acacia_bush_sapling +default:pine_bush_stem +default:pine_bush_needles +default:pine_bush_sapling default:sand_with_kelp @@ -1681,6 +1684,77 @@ minetest.register_node("default:acacia_bush_sapling", { end, }) +minetest.register_node("default:pine_bush_stem", { + description = "Pine Bush Stem", + drawtype = "plantlike", + visual_scale = 1.41, + tiles = {"default_pine_bush_stem.png"}, + inventory_image = "default_pine_bush_stem.png", + wield_image = "default_pine_bush_stem.png", + paramtype = "light", + sunlight_propagates = true, + groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16}, + }, +}) + +minetest.register_node("default:pine_bush_needles", { + description = "Pine Bush Needles", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_pine_needles.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:pine_bush_sapling"}, rarity = 5}, + {items = {"default:pine_bush_needles"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:pine_bush_sapling", { + description = "Pine Bush Sapling", + drawtype = "plantlike", + tiles = {"default_pine_bush_sapling.png"}, + inventory_image = "default_pine_bush_sapling.png", + wield_image = "default_pine_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(300, 1500)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:pine_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:sand_with_kelp", { description = "Kelp", drawtype = "plantlike_rooted", @@ -2532,3 +2606,9 @@ default.register_leafdecay({ leaves = {"default:acacia_bush_leaves"}, radius = 1, }) + +default.register_leafdecay({ + trunks = {"default:pine_bush_stem"}, + leaves = {"default:pine_bush_needles"}, + radius = 1, +}) diff --git a/mods/default/schematics/pine_bush.mts b/mods/default/schematics/pine_bush.mts new file mode 100644 index 0000000000000000000000000000000000000000..fbc6e17796ead10a08d02f4bb8c6b3c38356b84c GIT binary patch literal 111 zcmeYb3HD`RVPFQq`uchhm6%z?AeoYymROooVpWitml~f`TAUG|mztWAlUmFmhACBC ulA2pFCpm$E*-eE*IPs8xV_5P3|9}5}|IRG=|NnpXO%q)U7#V5>1egGgP$z}} literal 0 HcmV?d00001 diff --git a/mods/default/textures/default_pine_bush_sapling.png b/mods/default/textures/default_pine_bush_sapling.png new file mode 100644 index 0000000000000000000000000000000000000000..fadeff8711a31948791764056cef8b2313e70b89 GIT binary patch literal 166 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa4)6(aO=MsY))v=Ol@~RaFw;>H zwUn?k((rD zhXNQD-C&&|al>I#4r>k{C!4}T9y4=xfwM7}*e)++yL_HWiQ(H>*6)d_;md)BFnGH9 KxvXU>WC^)QwM`2{mLJiCzw;v{*y zyD)UH%6b4foCO|{#S9GG!XV7ZFl&wkP>{XE)7O>#5j&Tds7^R@Wd=|v(bL5-gyVX0 zf&yQLYO@C`8{5|eHa4}klRP}L90W_-GTC@;o#XKdmei9re!(aUqa4OXN_*<4}HN=&%5Gvjd{>xN49a9uX(Gf(!MVn}K|6{Nt(@P<_+IqgZY7SJ*V MPgg&ebxsLQ0LSS{(*OVf literal 0 HcmV?d00001 diff --git a/mods/default/trees.lua b/mods/default/trees.lua index 7f5556b2..a46ac5ac 100644 --- a/mods/default/trees.lua +++ b/mods/default/trees.lua @@ -85,6 +85,10 @@ function default.grow_sapling(pos) minetest.log("action", "An acacia bush sapling grows into a bush at ".. minetest.pos_to_string(pos)) default.grow_acacia_bush(pos) + elseif node.name == "default:pine_bush_sapling" then + minetest.log("action", "A pine bush sapling grows into a bush at ".. + minetest.pos_to_string(pos)) + default.grow_pine_bush(pos) elseif node.name == "default:emergent_jungle_sapling" then minetest.log("action", "An emergent jungle sapling grows into a tree at ".. minetest.pos_to_string(pos)) @@ -483,6 +487,16 @@ function default.grow_acacia_bush(pos) end +-- Pine bush + +function default.grow_pine_bush(pos) + local path = minetest.get_modpath("default") .. + "/schematics/pine_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 --