diff --git a/mods/CORE/mcl_init/init.lua b/mods/CORE/mcl_init/init.lua index d239c8d9ea..de50bf00af 100644 --- a/mods/CORE/mcl_init/init.lua +++ b/mods/CORE/mcl_init/init.lua @@ -11,7 +11,10 @@ mcl_vars.inventory_header = mcl_vars.gui_slots .. mcl_vars.gui_bg -- Mapgen variables local mg_name = minetest.get_mapgen_setting("mg_name") local minecraft_height_limit = 256 -if mg_name ~= "flat" then +local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true" + +if not superflat then + -- Normal mode --[[ Realm stacking (h is for height) - Overworld (h>=256) - Void (h>=1000) @@ -32,17 +35,13 @@ if mg_name ~= "flat" then mcl_vars.mg_bedrock_is_rough = true else + -- Classic superflat local ground = minetest.get_mapgen_setting("mgflat_ground_level") ground = tonumber(ground) if not ground then ground = 8 end - -- 1 perfectly flat bedrock layer - if minetest.get_mapgen_setting("mcl_superflat_classic") == "false" then - mcl_vars.mg_overworld_min = -30912 - else - mcl_vars.mg_overworld_min = ground - 3 - end + mcl_vars.mg_overworld_min = ground - 3 mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min @@ -58,14 +57,24 @@ mcl_vars.mg_nether_min = -29067 -- Carefully chosen to be at a mapchunk border mcl_vars.mg_nether_max = mcl_vars.mg_nether_min + 128 mcl_vars.mg_bedrock_nether_bottom_min = mcl_vars.mg_nether_min mcl_vars.mg_bedrock_nether_top_max = mcl_vars.mg_nether_max -mcl_vars.mg_lava_nether_max = mcl_vars.mg_nether_min + 31 -if mg_name ~= "flat" then +if not superflat then mcl_vars.mg_bedrock_nether_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min + 4 mcl_vars.mg_bedrock_nether_top_min = mcl_vars.mg_bedrock_nether_top_max - 4 + mcl_vars.mg_lava_nether_max = mcl_vars.mg_nether_min + 31 else - -- Thin bedrock in flat mapgen + -- Thin bedrock in classic superflat mapgen mcl_vars.mg_bedrock_nether_bottom_max = mcl_vars.mg_bedrock_nether_bottom_min mcl_vars.mg_bedrock_nether_top_min = mcl_vars.mg_bedrock_nether_top_max + mcl_vars.mg_lava_nether_max = mcl_vars.mg_nether_min + 2 +end +if mg_name == "flat" then + if superflat then + mcl_vars.mg_flat_nether_floor = mcl_vars.mg_bedrock_nether_bottom_max + 4 + mcl_vars.mg_flat_nether_ceiling = mcl_vars.mg_bedrock_nether_bottom_max + 52 + else + mcl_vars.mg_flat_nether_floor = mcl_vars.mg_lava_nether_max + 4 + mcl_vars.mg_flat_nether_ceiling = mcl_vars.mg_lava_nether_max + 52 + end end -- The End (surface at ca. Y = -27000) diff --git a/mods/ITEMS/mcl_portals/portal_nether.lua b/mods/ITEMS/mcl_portals/portal_nether.lua index d08bddef8d..64de52ba74 100644 --- a/mods/ITEMS/mcl_portals/portal_nether.lua +++ b/mods/ITEMS/mcl_portals/portal_nether.lua @@ -13,6 +13,7 @@ local TELEPORT_DELAY = 3 -- seconds before teleporting in Nether portal local TELEPORT_COOLOFF = 4 -- after object was teleported, for this many seconds it won't teleported again local mg_name = minetest.get_mapgen_setting("mg_name") +local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true" -- 3D noise local np_cave = { @@ -187,7 +188,7 @@ end local function find_nether_target_y(target_x, target_z) if mg_name == "flat" then - return mcl_vars.mg_bedrock_nether_bottom_max + 5 + return mcl_vars.mg_flat_nether_floor + 1 end local start_y = math.random(mcl_vars.mg_lava_nether_max + 1, mcl_vars.mg_bedrock_nether_top_min - 5) -- Search start if not nobj_cave then @@ -330,8 +331,15 @@ function mcl_portals.light_nether_portal(pos) local target = {x = p1.x, y = p1.y, z = p1.z} target.x = target.x + 1 if target.y < mcl_vars.mg_nether_max and target.y > mcl_vars.mg_nether_min then - if mg_name == "flat" then + if superflat then target.y = mcl_vars.mg_bedrock_overworld_max + 5 + elseif mg_name == "flat" then + local ground = minetest.get_mapgen_setting("mgflat_ground_level") + ground = tonumber(ground) + if not ground then + ground = 8 + end + target.y = ground + 2 else target.y = math.random(mcl_vars.mg_overworld_min + 40, mcl_vars.mg_overworld_min + 96) end diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index 20a086647d..f37929c4ae 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -2,6 +2,7 @@ local mg_name = minetest.get_mapgen_setting("mg_name") -- Some mapgen settings local imitate = minetest.settings:get("mcl_imitation_mode") +local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true" local generate_fallen_logs = false @@ -3209,7 +3210,7 @@ end -- Detect mapgen to select functions -- if mg_name ~= "singlenode" then - if mg_name ~= "flat" then + if not superflat then if mg_name ~= "v6" then register_biomes() register_biomelike_ores() @@ -3219,7 +3220,9 @@ if mg_name ~= "singlenode" then register_decorations() end else - -- Implementation of Minecraft's Superflat mapgen, classic style + -- Implementation of Minecraft's Superflat mapgen, classic style: + -- * Perfectly flat land, 1 grass biome, no decorations, no caves + -- * 4 layers, from top to bottom: grass block, dirt, dirt, bedrock minetest.clear_registered_biomes() minetest.clear_registered_decorations() minetest.clear_registered_schematics() diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 02645d0c32..0586404dbe 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -44,6 +44,7 @@ minetest.register_alias("mapgen_stair_sandstone_block", "mcl_stairs:stair_sandst minetest.register_alias("mapgen_stair_desert_stone", "mcl_stairs:stair_sandstone") local mg_name = minetest.get_mapgen_setting("mg_name") +local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true" local WITCH_HUT_HEIGHT = 3 -- Exact Y level to spawn witch huts at. This height refers to the height of the floor @@ -550,8 +551,7 @@ minetest.register_ore({ y_max = mcl_worlds.layer_to_y(32), }) -if mg_name ~= "flat" then - +if not superflat then -- Water and lava springs (single blocks of lava/water source) -- Water appears at nearly every height, but not near the bottom minetest.register_ore({ @@ -622,13 +622,8 @@ minetest.register_ore({ y_min = mcl_worlds.layer_to_y(62), y_max = mcl_worlds.layer_to_y(127), }) - end - - - - local function register_mgv6_decorations() -- Cacti @@ -951,20 +946,10 @@ end if mg_name == "v6" then register_mgv6_decorations() minetest.set_mapgen_setting("mg_flags", "caves,nodungeons,decorations,light", true) -elseif mg_name == "flat" then - local classic = minetest.get_mapgen_setting("mcl_superflat_classic") - if classic == nil then - classic = minetest.settings:get_bool("mcl_superflat_classic") - minetest.set_mapgen_setting("mcl_superflat_classic", "true", true) - end - if classic ~= "false" then - -- Enforce superflat-like mapgen: No hills, lakes or caves - minetest.set_mapgen_setting("mg_flags", "nocaves,nodungeons,nodecorations,light", true) - minetest.set_mapgen_setting("mgflat_spflags", "nolakes,nohills", true) - else - -- If superflat mode is disabled, mapgen is way more liberal - minetest.set_mapgen_setting("mg_flags", "caves,nodungeons,nodecorations,light", true) - end +elseif superflat then + -- Enforce superflat-like mapgen: No hills, lakes or caves + minetest.set_mapgen_setting("mg_flags", "nocaves,nodungeons,nodecorations,light", true) + minetest.set_mapgen_setting("mgflat_spflags", "nolakes,nohills", true) else minetest.set_mapgen_setting("mg_flags", "caves,nodungeons,decorations,light", true) end @@ -1731,7 +1716,7 @@ minetest.register_on_generated(function(minp, maxp, seed) -- Flat Nether if mg_name == "flat" then - lvm_used = set_layers(c_air, nil, mcl_vars.mg_bedrock_nether_bottom_max + 4, mcl_vars.mg_bedrock_nether_bottom_max + 52, minp, maxp, lvm_used) + lvm_used = set_layers(c_air, nil, mcl_vars.mg_flat_nether_floor, mcl_vars.mg_flat_nether_ceiling, minp, maxp, lvm_used) end -- Big lava seas by replacing air below a certain height diff --git a/settingtypes.txt b/settingtypes.txt index 7409690d0c..1290c25cd7 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -95,17 +95,24 @@ flame_sound (Flame sound) bool true # Feedback is appreciated. craftguide_progressive_mode (Enable recipe book progressive mode) bool false -# If enabled, the “flat” map generator generates a “classic” superflat map: -# Completely flat, 1 layer of grass blocks on top of 2 layers of dirt on -# top of a final layer of bedrock. -# Note if this is enabled, the setting “mgflat_flags” is ignored. To -# customize the “flat” map generator, you must disable this setting. -# Warning: Disabling this setting is currently EXPERIMENTAL! The generated map -# may not be that pretty. -mcl_superflat_classic (Classic superflat map generation) bool true - # Mobs difficulty. This is a number that will affect the initial and maximum # health and the amount of damage that mobs deal. Health and damage will # be multiplied with this number. # This feature is not finished yet! mob_difficulty (Mob difficulty factor) float 1.0 0.0 + +# If enabled, the “flat” map generator generates a Classic Superflat world: +# Completely flat, 1 layer of grass blocks on top of 2 layers of dirt on +# top of a final layer of bedrock. No caves, trees or plants. +# Also, if enabled, the setting “mgflat_flags” is ignored. +# If disabled, Minetest's default flat map generator is used, that is, trees, +# caves, and a deeper underground can be generated. +# +# Caution: Change this setting with care! +# If you change this setting, then play on an existing flat world +# that started with a different setting (e.g. you changed from superflat +# from “enabled” to “disabled”), there will be continuity errors when players +# reach new areas. Most importantly, the void is much higher in Superflat than +# in “normal” Flat. +# But creating new flat worlds after changing this setting should be safe. +mcl_superflat_classic (Classic superflat map generation) bool true