1
0
Fork 0

Don't generate lava and bedrock in singlenode

This commit is contained in:
Wuzzy 2017-09-05 22:47:48 +02:00
parent 1a120f2663
commit d69644fd47
2 changed files with 43 additions and 32 deletions

View File

@ -1956,6 +1956,7 @@ end
-- --
-- Detect mapgen to select functions -- Detect mapgen to select functions
-- --
if mg_name ~= "singlenode" then
minetest.clear_registered_biomes() minetest.clear_registered_biomes()
minetest.clear_registered_decorations() minetest.clear_registered_decorations()
minetest.clear_registered_schematics() minetest.clear_registered_schematics()
@ -1977,3 +1978,5 @@ register_dimension_ores()
register_dimension_decorations() register_dimension_decorations()
-- Overworld decorations for v6 are handled in mcl_mapgen_core -- Overworld decorations for v6 are handled in mcl_mapgen_core
end

View File

@ -1285,7 +1285,8 @@ minetest.register_on_generated(function(minp, maxp)
local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax}) local area = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
local lvm_used = false local lvm_used = false
-- Generate bedrock and lava layers -- Generate basic layer-based nodes: void, bedrock, realm barrier, lava seas, etc.
-- Also perform some basic node replacements.
if minp.y <= GEN_MAX then if minp.y <= GEN_MAX then
local max_y = math.min(maxp.y, GEN_MAX) local max_y = math.min(maxp.y, GEN_MAX)
@ -1293,8 +1294,20 @@ minetest.register_on_generated(function(minp, maxp)
for x = minp.x, maxp.x do for x = minp.x, maxp.x do
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
if mcl_vars.mg_bedrock_is_rough then -- The void
if mcl_util.is_in_void({x=x,y=y,z=z}) then
data[p_pos] = c_void
lvm_used = true
-- Realm barrier between the Overworld void and the End
elseif y >= mcl_vars.mg_realm_barrier_overworld_end_min and y <= mcl_vars.mg_realm_barrier_overworld_end_max then
data[p_pos] = c_realm_barrier
lvm_used = true
end
-- Bedrock layer checking (skip in singlenode)
local bedrock = false
if mg_name ~= "singlenode" and mcl_vars.mg_bedrock_is_rough then
local is_bedrock = function(y) local is_bedrock = function(y)
-- Bedrock layers with increasing levels of roughness, until a perfecly flat bedrock later at the bottom layer -- Bedrock layers with increasing levels of roughness, until a perfecly flat bedrock later at the bottom layer
-- This code assumes a bedrock height of 5 layers. -- This code assumes a bedrock height of 5 layers.
@ -1327,28 +1340,23 @@ minetest.register_on_generated(function(minp, maxp)
return math.random(1, top) <= top-1 return math.random(1, top) <= top-1
end end
if is_bedrock(y) then if is_bedrock(y) then
setdata = c_bedrock bedrock = true
end end
else elseif mg_name ~= "singlenode" then
-- Perfectly flat bedrock layer(s) -- Perfectly flat bedrock layer(s)
if (y >= mcl_vars.mg_bedrock_overworld_min and y <= mcl_vars.mg_bedrock_overworld_max) or if (y >= mcl_vars.mg_bedrock_overworld_min and y <= mcl_vars.mg_bedrock_overworld_max) or
(y >= mcl_vars.mg_bedrock_nether_bottom_min and y <= mcl_vars.mg_bedrock_nether_bottom_max) or (y >= mcl_vars.mg_bedrock_nether_bottom_min and y <= mcl_vars.mg_bedrock_nether_bottom_max) or
(y >= mcl_vars.mg_bedrock_nether_top_min and y <= mcl_vars.mg_bedrock_nether_top_max) then (y >= mcl_vars.mg_bedrock_nether_top_min and y <= mcl_vars.mg_bedrock_nether_top_max) then
setdata = c_bedrock bedrock = true
end end
end end
-- No more transformations in singlenode
if mg_name == "singlenode" then
-- do nothing
-- Bedrock, defined above -- Bedrock, defined above
if setdata then elseif bedrock then
data[p_pos] = setdata data[p_pos] = c_bedrock
lvm_used = true
-- The void
elseif mcl_util.is_in_void({x=x,y=y,z=z}) then
data[p_pos] = c_void
lvm_used = true
-- Realm barrier between the Overworld void and the End
elseif y >= mcl_vars.mg_realm_barrier_overworld_end_min and y <= mcl_vars.mg_realm_barrier_overworld_end_max then
data[p_pos] = c_realm_barrier
lvm_used = true lvm_used = true
-- Flat Nether -- Flat Nether
elseif mg_name == "flat" and y >= mcl_vars.mg_bedrock_nether_bottom_max + 4 and y <= mcl_vars.mg_bedrock_nether_bottom_max + 52 then elseif mg_name == "flat" and y >= mcl_vars.mg_bedrock_nether_bottom_max + 4 and y <= mcl_vars.mg_bedrock_nether_bottom_max + 52 then