forked from VoxeLibre/VoxeLibre
Partially re-implement Superflat
This commit is contained in:
parent
85ce127e6b
commit
73957c46b2
|
@ -8,8 +8,19 @@ mcl_vars.gui_bg_img = ""
|
||||||
|
|
||||||
mcl_vars.inventory_header = mcl_vars.gui_slots .. mcl_vars.gui_bg
|
mcl_vars.inventory_header = mcl_vars.gui_slots .. mcl_vars.gui_bg
|
||||||
|
|
||||||
mcl_vars.bedrock_overworld_min = -62
|
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||||
mcl_vars.bedrock_overworld_max = -58
|
if mg_name ~= "flat" then
|
||||||
|
-- 1 flat bedrock layer with 4 rough layers above
|
||||||
|
mcl_vars.bedrock_overworld_min = -62
|
||||||
|
mcl_vars.bedrock_overworld_max = mcl_vars.bedrock_overworld_min + 4
|
||||||
|
mcl_vars.bedrock_is_rough = true
|
||||||
|
else
|
||||||
|
-- 1 perfectly flat bedrock layer
|
||||||
|
local ground = minetest.get_mapgen_setting("mgflat_ground_level")
|
||||||
|
mcl_vars.bedrock_overworld_min = ground - 3
|
||||||
|
mcl_vars.bedrock_overworld_max = mcl_vars.bedrock_overworld_min
|
||||||
|
mcl_vars.bedrock_is_rough = false
|
||||||
|
end
|
||||||
|
|
||||||
-- Set default stack sizes
|
-- Set default stack sizes
|
||||||
minetest.nodedef_default.stack_max = 64
|
minetest.nodedef_default.stack_max = 64
|
||||||
|
|
|
@ -1,11 +1,25 @@
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Register biomes
|
-- Register biomes for mapgens other than v6
|
||||||
-- EXPERIMENTAL!
|
-- EXPERIMENTAL!
|
||||||
--
|
--
|
||||||
|
|
||||||
-- All mapgens except mgv6 and singlenode
|
local function register_classic_superflat_biome()
|
||||||
|
-- Classic Superflat: bedrock (not part of biome), 2 dirt, 1 grass block
|
||||||
|
minetest.register_biome({
|
||||||
|
name = "flat",
|
||||||
|
node_top = "mcl_core:dirt_with_grass",
|
||||||
|
depth_top = 1,
|
||||||
|
node_filler = "mcl_core:dirt",
|
||||||
|
depth_filler = 2,
|
||||||
|
y_min = 1,
|
||||||
|
y_max = 31000,
|
||||||
|
heat_point = 50,
|
||||||
|
humidity_point = 50,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- All mapgens except mgv6, flat and singlenode
|
||||||
local function register_biomes()
|
local function register_biomes()
|
||||||
|
|
||||||
minetest.register_biome({
|
minetest.register_biome({
|
||||||
|
@ -227,7 +241,10 @@ end
|
||||||
-- Detect mapgen to select functions
|
-- Detect mapgen to select functions
|
||||||
--
|
--
|
||||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||||
if mg_name ~= "v6" then
|
if mg_name ~= "v6" and mg_name ~= "flat" then
|
||||||
register_biomes()
|
register_biomes()
|
||||||
register_decorations()
|
register_decorations()
|
||||||
|
elseif mg_name == "flat" then
|
||||||
|
-- Implementation of Minecraft's Superflat mapgen, classic style
|
||||||
|
register_classic_superflat_biome()
|
||||||
end
|
end
|
||||||
|
|
|
@ -466,7 +466,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
-- Generate 5 layers of bedrock, with increasing levels of roughness, until a perfecly flat bedrock later at the bottom layer
|
-- Generate bedrock layer or layers
|
||||||
local BEDROCK_MIN = mcl_vars.bedrock_overworld_min
|
local BEDROCK_MIN = mcl_vars.bedrock_overworld_min
|
||||||
local BEDROCK_MAX = mcl_vars.bedrock_overworld_max
|
local BEDROCK_MAX = mcl_vars.bedrock_overworld_max
|
||||||
|
|
||||||
|
@ -486,23 +486,34 @@ minetest.register_on_generated(function(minp, maxp)
|
||||||
for z = minp.z, maxp.z do
|
for z = minp.z, maxp.z do
|
||||||
local p_pos = area:index(x, y, z)
|
local p_pos = area:index(x, y, z)
|
||||||
local setdata = nil
|
local setdata = nil
|
||||||
if y == BEDROCK_MAX then
|
if mcl_vars.bedrock_is_rough then
|
||||||
-- 50% bedrock chance
|
-- Bedrock layers with increasing levels of roughness, until a perfecly flat bedrock later at the bottom layer
|
||||||
if math.random(1,2) == 1 then setdata = c_bedrock end
|
-- This code assumes a bedrock height of 5 layers.
|
||||||
elseif y == BEDROCK_MAX -1 then
|
if y == BEDROCK_MAX then
|
||||||
-- 66.666...%
|
-- 50% bedrock chance
|
||||||
if math.random(1,3) <= 2 then setdata = c_bedrock end
|
if math.random(1,2) == 1 then setdata = c_bedrock end
|
||||||
elseif y == BEDROCK_MAX -2 then
|
elseif y == BEDROCK_MAX -1 then
|
||||||
-- 75%
|
-- 66.666...%
|
||||||
if math.random(1,4) <= 3 then setdata = c_bedrock end
|
if math.random(1,3) <= 2 then setdata = c_bedrock end
|
||||||
elseif y == BEDROCK_MAX -3 then
|
elseif y == BEDROCK_MAX -2 then
|
||||||
-- 90%
|
-- 75%
|
||||||
if math.random(1,10) <= 9 then setdata = c_bedrock end
|
if math.random(1,4) <= 3 then setdata = c_bedrock end
|
||||||
elseif y == BEDROCK_MAX -4 then
|
elseif y == BEDROCK_MAX -3 then
|
||||||
-- 100%
|
-- 90%
|
||||||
setdata = c_bedrock
|
if math.random(1,10) <= 9 then setdata = c_bedrock end
|
||||||
elseif y < BEDROCK_MIN then
|
elseif y == BEDROCK_MAX -4 then
|
||||||
setdata = c_void
|
-- 100%
|
||||||
|
setdata = c_bedrock
|
||||||
|
elseif y < BEDROCK_MIN then
|
||||||
|
setdata = c_void
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- Perfectly flat bedrock layer(s)
|
||||||
|
if y >= BEDROCK_MIN and y <= BEDROCK_MAX then
|
||||||
|
setdata = c_bedrock
|
||||||
|
elseif y < BEDROCK_MIN then
|
||||||
|
setdata = c_void
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if setdata then
|
if setdata then
|
||||||
data[p_pos] = setdata
|
data[p_pos] = setdata
|
||||||
|
|
Loading…
Reference in New Issue