From 150122bfe7214254e954a0a8184ac229c2b273c5 Mon Sep 17 00:00:00 2001
From: Paramat <paramat@users.noreply.github.com>
Date: Wed, 18 Dec 2019 23:59:45 +0000
Subject: [PATCH] Remove Mapgen V7 floatland biome code

In preparation for a new Mapgen V7 floatland implementation.
---
 mods/butterflies/init.lua |   2 +-
 mods/default/mapgen.lua   | 122 +++++++-------------------------------
 mods/flowers/mapgen.lua   |   5 +-
 3 files changed, 25 insertions(+), 104 deletions(-)

diff --git a/mods/butterflies/init.lua b/mods/butterflies/init.lua
index 6fd839f..650e7da 100644
--- a/mods/butterflies/init.lua
+++ b/mods/butterflies/init.lua
@@ -102,7 +102,7 @@ minetest.register_decoration({
 	place_offset_y = 2,
 	sidelen = 80,
 	fill_ratio = 0.005,
-	biomes = {"grassland", "deciduous_forest", "floatland_grassland"},
+	biomes = {"grassland", "deciduous_forest"},
 	y_max = 31000,
 	y_min = 1,
 	decoration = {
diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua
index e5b90bd..afca9f8 100644
--- a/mods/default/mapgen.lua
+++ b/mods/default/mapgen.lua
@@ -576,7 +576,7 @@ function default.register_ores()
 		-- Only where default:dirt is present as surface material
 		biomes = {"taiga", "snowy_grassland", "grassland", "coniferous_forest",
 				"deciduous_forest", "deciduous_forest_shore", "rainforest",
-				"rainforest_swamp", "floatland_coniferous_forest"}
+				"rainforest_swamp"}
 	})
 
 	-- Gravel
@@ -890,7 +890,7 @@ end
 
 -- All mapgens except mgv6
 
-function default.register_biomes(upper_limit)
+function default.register_biomes()
 
 	-- Icesheet
 
@@ -909,7 +909,7 @@ function default.register_biomes(upper_limit)
 		depth_riverbed = 2,
 		node_dungeon = "default:ice",
 		node_dungeon_stair = "stairs:stair_ice",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = -8,
 		heat_point = 0,
 		humidity_point = 73,
@@ -956,7 +956,7 @@ function default.register_biomes(upper_limit)
 		node_dungeon = "default:cobble",
 		node_dungeon_alt = "default:mossycobble",
 		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = 47,
 		heat_point = 0,
 		humidity_point = 40,
@@ -1043,7 +1043,7 @@ function default.register_biomes(upper_limit)
 		node_dungeon = "default:cobble",
 		node_dungeon_alt = "default:mossycobble",
 		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = 4,
 		heat_point = 25,
 		humidity_point = 70,
@@ -1095,7 +1095,7 @@ function default.register_biomes(upper_limit)
 		node_dungeon = "default:cobble",
 		node_dungeon_alt = "default:mossycobble",
 		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = 4,
 		heat_point = 20,
 		humidity_point = 35,
@@ -1146,7 +1146,7 @@ function default.register_biomes(upper_limit)
 		node_dungeon = "default:cobble",
 		node_dungeon_alt = "default:mossycobble",
 		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = 6,
 		heat_point = 50,
 		humidity_point = 35,
@@ -1213,7 +1213,7 @@ function default.register_biomes(upper_limit)
 		node_dungeon = "default:cobble",
 		node_dungeon_alt = "default:mossycobble",
 		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = 6,
 		heat_point = 45,
 		humidity_point = 70,
@@ -1280,7 +1280,7 @@ function default.register_biomes(upper_limit)
 		node_dungeon = "default:cobble",
 		node_dungeon_alt = "default:mossycobble",
 		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = 1,
 		heat_point = 60,
 		humidity_point = 68,
@@ -1347,7 +1347,7 @@ function default.register_biomes(upper_limit)
 		depth_riverbed = 2,
 		node_dungeon = "default:desert_stone",
 		node_dungeon_stair = "stairs:stair_desert_stone",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = 4,
 		heat_point = 92,
 		humidity_point = 16,
@@ -1397,7 +1397,7 @@ function default.register_biomes(upper_limit)
 		depth_riverbed = 2,
 		node_dungeon = "default:sandstonebrick",
 		node_dungeon_stair = "stairs:stair_sandstone_block",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = 4,
 		heat_point = 60,
 		humidity_point = 0,
@@ -1446,7 +1446,7 @@ function default.register_biomes(upper_limit)
 		node_dungeon = "default:cobble",
 		node_dungeon_alt = "default:mossycobble",
 		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = 4,
 		heat_point = 40,
 		humidity_point = 0,
@@ -1496,7 +1496,7 @@ function default.register_biomes(upper_limit)
 		node_dungeon = "default:cobble",
 		node_dungeon_alt = "default:mossycobble",
 		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = 1,
 		heat_point = 89,
 		humidity_point = 42,
@@ -1563,7 +1563,7 @@ function default.register_biomes(upper_limit)
 		node_dungeon = "default:cobble",
 		node_dungeon_alt = "default:mossycobble",
 		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = upper_limit,
+		y_max = 31000,
 		y_min = 1,
 		heat_point = 86,
 		humidity_point = 65,
@@ -1619,59 +1619,6 @@ function default.register_biomes(upper_limit)
 end
 
 
--- Biomes for floatlands
-
--- TODO Temporary simple biomes to be replaced by special floatland biomes later.
-
-function default.register_floatland_biomes(floatland_level, shadow_limit)
-
-	minetest.register_biome({
-		name = "floatland_grassland",
-		node_top = "default:dirt_with_grass",
-		depth_top = 1,
-		node_filler = "default:dirt",
-		depth_filler = 1,
-		node_dungeon = "default:cobble",
-		node_dungeon_alt = "default:mossycobble",
-		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = 31000,
-		y_min = floatland_level + 2,
-		heat_point = 50,
-		humidity_point = 25,
-	})
-
-	minetest.register_biome({
-		name = "floatland_coniferous_forest",
-		node_top = "default:dirt_with_coniferous_litter",
-		depth_top = 1,
-		node_filler = "default:dirt",
-		depth_filler = 3,
-		node_dungeon = "default:cobble",
-		node_dungeon_alt = "default:mossycobble",
-		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = 31000,
-		y_min = floatland_level + 2,
-		heat_point = 50,
-		humidity_point = 75,
-	})
-
-	minetest.register_biome({
-		name = "floatland_ocean",
-		node_top = "default:sand",
-		depth_top = 1,
-		node_filler = "default:sand",
-		depth_filler = 3,
-		node_dungeon = "default:cobble",
-		node_dungeon_alt = "default:mossycobble",
-		node_dungeon_stair = "stairs:stair_cobble",
-		y_max = floatland_level + 1,
-		y_min = shadow_limit,
-		heat_point = 50,
-		humidity_point = 50,
-	})
-end
-
-
 --
 -- Register decorations
 --
@@ -1787,7 +1734,7 @@ local function register_grass_decoration(offset, scale, length)
 			octaves = 3,
 			persist = 0.6
 		},
-		biomes = {"grassland", "deciduous_forest", "floatland_grassland"},
+		biomes = {"grassland", "deciduous_forest"},
 		y_max = 31000,
 		y_min = 1,
 		decoration = "default:grass_" .. length,
@@ -1829,7 +1776,7 @@ local function register_fern_decoration(seed, length)
 			octaves = 3,
 			persist = 0.7
 		},
-		biomes = {"coniferous_forest", "floatland_coniferous_forest"},
+		biomes = {"coniferous_forest"},
 		y_max = 31000,
 		y_min = 6,
 		decoration = "default:fern_" .. length,
@@ -2011,7 +1958,7 @@ function default.register_decorations()
 			octaves = 3,
 			persist = 0.66
 		},
-		biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"},
+		biomes = {"taiga", "coniferous_forest"},
 		y_max = 31000,
 		y_min = 4,
 		schematic = minetest.get_modpath("default") .. "/schematics/pine_tree.mts",
@@ -2031,7 +1978,7 @@ function default.register_decorations()
 			octaves = 3,
 			persist = 0.66
 		},
-		biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"},
+		biomes = {"taiga", "coniferous_forest"},
 		y_max = 31000,
 		y_min = 4,
 		schematic = minetest.get_modpath("default") .. "/schematics/small_pine_tree.mts",
@@ -2045,7 +1992,7 @@ function default.register_decorations()
 		place_offset_y = 1,
 		sidelen = 80,
 		fill_ratio = 0.0018,
-		biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"},
+		biomes = {"taiga", "coniferous_forest"},
 		y_max = 31000,
 		y_min = 4,
 		schematic = minetest.get_modpath("default") .. "/schematics/pine_log.mts",
@@ -2230,8 +2177,7 @@ function default.register_decorations()
 			octaves = 3,
 			persist = 0.7,
 		},
-		biomes = {"grassland", "deciduous_forest",
-			"floatland_grassland"},
+		biomes = {"grassland", "deciduous_forest"},
 		y_max = 31000,
 		y_min = 1,
 		schematic = minetest.get_modpath("default") .. "/schematics/bush.mts",
@@ -2503,22 +2449,9 @@ end
 
 
 --
--- Detect mapgen, flags and parameters to select functions
+-- Detect mapgen to select functions
 --
 
--- Get setting or default
-local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags") or
-	"mountains, ridges, nofloatlands, caverns"
-local captures_float = string.match(mgv7_spflags, "floatlands")
-local captures_nofloat = string.match(mgv7_spflags, "nofloatlands")
-
--- Get setting or default
--- Make global for mods to use to register floatland biomes
-default.mgv7_floatland_level =
-	minetest.get_mapgen_setting("mgv7_floatland_level") or 1280
-default.mgv7_shadow_limit =
-	minetest.get_mapgen_setting("mgv7_shadow_limit") or 1024
-
 minetest.clear_registered_biomes()
 minetest.clear_registered_ores()
 minetest.clear_registered_decorations()
@@ -2528,19 +2461,8 @@ local mg_name = minetest.get_mapgen_setting("mg_name")
 if mg_name == "v6" then
 	default.register_mgv6_ores()
 	default.register_mgv6_decorations()
--- Need to check for 'nofloatlands' because that contains
--- 'floatlands' which makes the second condition true.
-elseif mg_name == "v7" and
-		captures_float == "floatlands" and
-		captures_nofloat ~= "nofloatlands" then
-	-- Mgv7 with floatlands and floatland biomes
-	default.register_biomes(default.mgv7_shadow_limit - 1)
-	default.register_floatland_biomes(
-		default.mgv7_floatland_level, default.mgv7_shadow_limit)
-	default.register_ores()
-	default.register_decorations()
 else
-	default.register_biomes(31000)
+	default.register_biomes()
 	default.register_ores()
 	default.register_decorations()
 end
diff --git a/mods/flowers/mapgen.lua b/mods/flowers/mapgen.lua
index 85e19b7..f282f50 100644
--- a/mods/flowers/mapgen.lua
+++ b/mods/flowers/mapgen.lua
@@ -100,7 +100,7 @@ local function register_flower(seed, flower_name)
 			octaves = 3,
 			persist = 0.6
 		},
-		biomes = {"grassland", "deciduous_forest", "floatland_grassland"},
+		biomes = {"grassland", "deciduous_forest"},
 		y_max = 31000,
 		y_min = 1,
 		decoration = "flowers:"..flower_name,
@@ -121,8 +121,7 @@ local function register_mushroom(mushroom_name)
 			octaves = 3,
 			persist = 0.66
 		},
-		biomes = {"deciduous_forest", "coniferous_forest",
-			"floatland_coniferous_forest"},
+		biomes = {"deciduous_forest", "coniferous_forest"},
 		y_max = 31000,
 		y_min = 1,
 		decoration = "flowers:"..mushroom_name,