From 160dc21bc14a9869fb1dcae30a2eed3f3112c004 Mon Sep 17 00:00:00 2001
From: paramat <paramat@users.noreply.github.com>
Date: Sun, 4 Mar 2018 19:47:06 +0000
Subject: [PATCH] Pine trees: Add small pine tree and mix into coniferous
 forests

Use noises to create a varying mix in coniferous forest biomes:
Areas of large pines only, areas of small pines only, mixed areas.
While also having areas of high and low tree densities.
Saplings grow into large or small pines with equal chance.
---
 mods/default/mapgen.lua                       |  30 ++++++++++++------
 mods/default/schematics/small_pine_tree.mts   | Bin 0 -> 173 bytes
 .../small_pine_tree_from_sapling.mts          | Bin 0 -> 171 bytes
 .../snowy_small_pine_tree_from_sapling.mts    | Bin 0 -> 202 bytes
 mods/default/trees.lua                        |  20 +++++++++---
 5 files changed, 37 insertions(+), 13 deletions(-)
 create mode 100644 mods/default/schematics/small_pine_tree.mts
 create mode 100644 mods/default/schematics/small_pine_tree_from_sapling.mts
 create mode 100644 mods/default/schematics/snowy_small_pine_tree_from_sapling.mts

diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua
index 5810bb6..f236f7b 100644
--- a/mods/default/mapgen.lua
+++ b/mods/default/mapgen.lua
@@ -1758,7 +1758,7 @@ function default.register_decorations()
 	minetest.register_decoration({
 		deco_type = "schematic",
 		place_on = {"default:dirt_with_rainforest_litter", "default:dirt"},
-		sidelen = 16,
+		sidelen = 80,
 		fill_ratio = 0.1,
 		biomes = {"rainforest", "rainforest_swamp"},
 		y_max = 31000,
@@ -1771,7 +1771,7 @@ function default.register_decorations()
 	minetest.register_decoration({
 		deco_type = "schematic",
 		place_on = {"default:dirt_with_rainforest_litter", "default:dirt"},
-		sidelen = 16,
+		sidelen = 80,
 		fill_ratio = 0.005,
 		biomes = {"rainforest", "rainforest_swamp"},
 		y_max = 31000,
@@ -1781,15 +1781,15 @@ function default.register_decorations()
 		rotation = "random",
 	})
 
-	-- Taiga and temperate coniferous forest pine tree and log
+	-- Taiga and temperate coniferous forest pine tree, small pine tree and log
 
 	minetest.register_decoration({
 		deco_type = "schematic",
 		place_on = {"default:dirt_with_snow", "default:dirt_with_coniferous_litter"},
 		sidelen = 16,
 		noise_params = {
-			offset = 0.036,
-			scale = 0.022,
+			offset = 0.010,
+			scale = 0.048,
 			spread = {x = 250, y = 250, z = 250},
 			seed = 2,
 			octaves = 3,
@@ -1805,10 +1805,10 @@ function default.register_decorations()
 	minetest.register_decoration({
 		deco_type = "schematic",
 		place_on = {"default:dirt_with_snow", "default:dirt_with_coniferous_litter"},
-		sidelen = 80,
+		sidelen = 16,
 		noise_params = {
-			offset = 0.0018,
-			scale = 0.0011,
+			offset = 0.010,
+			scale = -0.048,
 			spread = {x = 250, y = 250, z = 250},
 			seed = 2,
 			octaves = 3,
@@ -1816,6 +1816,18 @@ function default.register_decorations()
 		},
 		biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"},
 		y_max = 31000,
+		y_min = 2,
+		schematic = minetest.get_modpath("default") .. "/schematics/small_pine_tree.mts",
+		flags = "place_center_x, place_center_z",
+	})
+
+	minetest.register_decoration({
+		deco_type = "schematic",
+		place_on = {"default:dirt_with_snow", "default:dirt_with_coniferous_litter"},
+		sidelen = 80,
+		fill_ratio = 0.0018,
+		biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"},
+		y_max = 31000,
 		y_min = 1,
 		schematic = minetest.get_modpath("default") .. "/schematics/pine_log.mts",
 		flags = "place_center_x",
@@ -2039,7 +2051,7 @@ function default.register_decorations()
 	minetest.register_decoration({
 		deco_type = "simple",
 		place_on = {"default:dirt_with_rainforest_litter"},
-		sidelen = 16,
+		sidelen = 80,
 		fill_ratio = 0.1,
 		biomes = {"rainforest"},
 		y_max = 31000,
diff --git a/mods/default/schematics/small_pine_tree.mts b/mods/default/schematics/small_pine_tree.mts
new file mode 100644
index 0000000000000000000000000000000000000000..1b27a84f88287b093a8d9b99ab7d4287b2d224e1
GIT binary patch
literal 173
zcmeYb3HD`RVPIw8VPLJVx3{;ihX4j<2Ij=fA_kF^)U?FXoD!>o%)He2ywuc`oYZ0l
zK@`!FqSVxiId20U`3@*>Fx#EGJhSJlu7}#JotIZ-R!!LE(qK|xzx*H9v`WKWdWEZ>
z*G&ni(D=OkRzsHF-b+W5kM8^VWb6OaXHFF_E|bhl2|MR6^~mYz-W826)_jRQR($y3
P%i8)QHyHl;t8fAUJ_b#<

literal 0
HcmV?d00001

diff --git a/mods/default/schematics/small_pine_tree_from_sapling.mts b/mods/default/schematics/small_pine_tree_from_sapling.mts
new file mode 100644
index 0000000000000000000000000000000000000000..dc438a9d11e28503f53f2f17c120f422af4d46a2
GIT binary patch
literal 171
zcmeYb3HD`RVPIw8VPLJVx3{;ihX4j<2Ij=fA_kF^)U?FXoD!>o%)He2ywuc`oYZ0l
zK@`!FqSVxiId22s@---Mu*Ch5+bcH1a!H%s@2d|b&fR67tigND>iPPFdEx2PRsFus
z@fQ-Fe)7vwwF$4Z*Qb1p*qDE>^6h^ni(fKV`Br4AJ^k`!SKw!^AhoK->ZyhIC)n(L
M-!Eakqg0_206@k_!2kdN

literal 0
HcmV?d00001

diff --git a/mods/default/schematics/snowy_small_pine_tree_from_sapling.mts b/mods/default/schematics/snowy_small_pine_tree_from_sapling.mts
new file mode 100644
index 0000000000000000000000000000000000000000..76fe345b131df15ba2350e7236c8c048c9caa168
GIT binary patch
literal 202
zcmeYb3HD`RVPIw8WnitZx3{l{0iYmrVrCJ8NJ?s2Vrfo^RY7K6YJ6U5YD!LOF#``w
zv^X!noIw!A1FI=1N=>bp^LEljz6J#jS4X=!{_6vd%}7*UJ8xHBla*e&Ps5fCdV!Wn
z7jGNsRYa_{zIJcL#o(hg8DFn2nQ|gv^R>>N)}B^Bo$Qdk_vSjzd$_v(z?of)=dXHi
kJrQZS|J)Wi^Mds}&jfb%tX1Q5YTqjPXV*$u+r!#w07tY|UjP6A

literal 0
HcmV?d00001

diff --git a/mods/default/trees.lua b/mods/default/trees.lua
index c440309..7f5556b 100644
--- a/mods/default/trees.lua
+++ b/mods/default/trees.lua
@@ -411,8 +411,14 @@ end
 -- New pine tree
 
 function default.grow_new_pine_tree(pos)
-	local path = minetest.get_modpath("default") ..
-		"/schematics/pine_tree_from_sapling.mts"
+	local path
+	if math.random() > 0.5 then
+		path = minetest.get_modpath("default") ..
+			"/schematics/pine_tree_from_sapling.mts"
+	else
+		path = minetest.get_modpath("default") ..
+			"/schematics/small_pine_tree_from_sapling.mts"
+	end
 	minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
 		path, "0", nil, false)
 end
@@ -421,8 +427,14 @@ end
 -- New snowy pine tree
 
 function default.grow_new_snowy_pine_tree(pos)
-	local path = minetest.get_modpath("default") ..
-		"/schematics/snowy_pine_tree_from_sapling.mts"
+	local path
+	if math.random() > 0.5 then
+		path = minetest.get_modpath("default") ..
+			"/schematics/snowy_pine_tree_from_sapling.mts"
+	else
+		path = minetest.get_modpath("default") ..
+			"/schematics/snowy_small_pine_tree_from_sapling.mts"
+	end
 	minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
 		path, "random", nil, false)
 end