mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
New lava generator: Spawn in air in layers 1-10
This commit is contained in:
parent
d13fe532c5
commit
ef06d345df
3 changed files with 25 additions and 9 deletions
|
@ -18,6 +18,8 @@ if mg_name ~= "flat" then
|
||||||
-- 1 flat bedrock layer with 4 rough layers above
|
-- 1 flat bedrock layer with 4 rough layers above
|
||||||
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
|
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min
|
||||||
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min + 4
|
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min + 4
|
||||||
|
mcl_vars.mg_lava_overworld_max = mcl_vars.mg_overworld_min + 10
|
||||||
|
mcl_vars.mg_lava = true
|
||||||
mcl_vars.mg_bedrock_is_rough = true
|
mcl_vars.mg_bedrock_is_rough = true
|
||||||
else
|
else
|
||||||
local ground = minetest.get_mapgen_setting("mgflat_ground_level")
|
local ground = minetest.get_mapgen_setting("mgflat_ground_level")
|
||||||
|
@ -30,6 +32,7 @@ else
|
||||||
-- 1 perfectly flat bedrock layer
|
-- 1 perfectly flat bedrock layer
|
||||||
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min - 2
|
mcl_vars.mg_bedrock_overworld_min = mcl_vars.mg_overworld_min - 2
|
||||||
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min
|
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min
|
||||||
|
mcl_vars.mg_lava = false
|
||||||
mcl_vars.mg_bedrock_is_rough = false
|
mcl_vars.mg_bedrock_is_rough = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ minetest.register_alias("mapgen_dirt_with_snow", "mcl_core:dirt_with_grass_snow"
|
||||||
minetest.register_alias("mapgen_sand", "mcl_core:sand")
|
minetest.register_alias("mapgen_sand", "mcl_core:sand")
|
||||||
minetest.register_alias("mapgen_gravel", "mcl_core:gravel")
|
minetest.register_alias("mapgen_gravel", "mcl_core:gravel")
|
||||||
minetest.register_alias("mapgen_clay", "mcl_core:clay")
|
minetest.register_alias("mapgen_clay", "mcl_core:clay")
|
||||||
minetest.register_alias("mapgen_lava_source", "mcl_core:lava_source")
|
minetest.register_alias("mapgen_lava_source", "air") -- Built-in lava generator is too unpredictable, we generate lava on our own
|
||||||
minetest.register_alias("mapgen_cobble", "mcl_core:cobble")
|
minetest.register_alias("mapgen_cobble", "mcl_core:cobble")
|
||||||
minetest.register_alias("mapgen_mossycobble", "mcl_core:mossycobble")
|
minetest.register_alias("mapgen_mossycobble", "mcl_core:mossycobble")
|
||||||
minetest.register_alias("mapgen_junglegrass", "mcl_flowers:fern")
|
minetest.register_alias("mapgen_junglegrass", "mcl_flowers:fern")
|
||||||
|
@ -521,7 +521,7 @@ minetest.register_ore({
|
||||||
ore_type = "scatter",
|
ore_type = "scatter",
|
||||||
ore = "mcl_core:lava_source",
|
ore = "mcl_core:lava_source",
|
||||||
wherein = stonelike,
|
wherein = stonelike,
|
||||||
clust_scarcity = 4000,
|
clust_scarcity = 2000,
|
||||||
clust_num_ores = 1,
|
clust_num_ores = 1,
|
||||||
clust_size = 1,
|
clust_size = 1,
|
||||||
y_min = mcl_util.layer_to_y(1),
|
y_min = mcl_util.layer_to_y(1),
|
||||||
|
@ -980,6 +980,7 @@ end)
|
||||||
-- Generate bedrock layer or layers
|
-- Generate bedrock layer or layers
|
||||||
local BEDROCK_MIN = mcl_vars.mg_bedrock_overworld_min
|
local BEDROCK_MIN = mcl_vars.mg_bedrock_overworld_min
|
||||||
local BEDROCK_MAX = mcl_vars.mg_bedrock_overworld_max
|
local BEDROCK_MAX = mcl_vars.mg_bedrock_overworld_max
|
||||||
|
local GEN_MAX = mcl_vars.mg_lava_overworld_max or BEDROCK_MAX
|
||||||
|
|
||||||
-- Buffer for LuaVoxelManip
|
-- Buffer for LuaVoxelManip
|
||||||
local lvm_buffer = {}
|
local lvm_buffer = {}
|
||||||
|
@ -991,12 +992,14 @@ 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 layers
|
-- Generate bedrock and lava layers
|
||||||
if minp.y <= BEDROCK_MAX then
|
if minp.y <= GEN_MAX then
|
||||||
local c_bedrock = minetest.get_content_id("mcl_core:bedrock")
|
local c_bedrock = minetest.get_content_id("mcl_core:bedrock")
|
||||||
local c_void = minetest.get_content_id("mcl_core:void")
|
local c_void = minetest.get_content_id("mcl_core:void")
|
||||||
|
local c_lava = minetest.get_content_id("mcl_core:lava_source")
|
||||||
|
local c_air = minetest.get_content_id("air")
|
||||||
|
|
||||||
local max_y = math.min(maxp.y, BEDROCK_MAX)
|
local max_y = math.min(maxp.y, GEN_MAX)
|
||||||
|
|
||||||
for y = minp.y, max_y do
|
for y = minp.y, max_y do
|
||||||
for x = minp.x, maxp.x do
|
for x = minp.x, maxp.x do
|
||||||
|
@ -1036,6 +1039,11 @@ minetest.register_on_generated(function(minp, maxp)
|
||||||
if setdata then
|
if setdata then
|
||||||
data[p_pos] = setdata
|
data[p_pos] = setdata
|
||||||
lvm_used = true
|
lvm_used = true
|
||||||
|
elseif mcl_vars.mg_lava and y <= mcl_vars.mg_lava_overworld_max then
|
||||||
|
if data[p_pos] == c_air then
|
||||||
|
data[p_pos] = c_lava
|
||||||
|
end
|
||||||
|
lvm_used = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,7 +73,12 @@ if setting then
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Max. and min. heights between rail corridors are generated
|
-- Max. and min. heights between rail corridors are generated
|
||||||
local height_min = mcl_vars.mg_bedrock_overworld_max + 5 -- FIXME: Above lava layers
|
local height_min
|
||||||
|
if mcl_vars.mg_lava then
|
||||||
|
height_min = mcl_vars.mg_lava_overworld_max + 2
|
||||||
|
else
|
||||||
|
height_min = mcl_vars.mg_bedrock_overworld_max + 2
|
||||||
|
end
|
||||||
local height_max = mcl_util.layer_to_y(60)
|
local height_max = mcl_util.layer_to_y(60)
|
||||||
|
|
||||||
-- Chaos Mode: If enabled, rail corridors don't stop generating when hitting obstacles
|
-- Chaos Mode: If enabled, rail corridors don't stop generating when hitting obstacles
|
||||||
|
@ -567,9 +572,9 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
if minp.y < height_max and maxp.y > height_min and pr:next() < probability_railcaves_in_chunk then
|
if minp.y < height_max and maxp.y > height_min and pr:next() < probability_railcaves_in_chunk then
|
||||||
-- Get semi-random height in chunk
|
-- Get semi-random height in chunk
|
||||||
|
|
||||||
local buffer = 5
|
local buffer = 4
|
||||||
local y = pr:next(minp.y + buffer, maxp.y - buffer)
|
local y = pr:next(minp.y, maxp.y)
|
||||||
y = math.floor(math.max(height_min, math.min(height_max, y)))
|
y = math.floor(math.max(height_min + buffer, math.min(height_max - buffer, y)))
|
||||||
local p = {x=minp.x+(maxp.x-minp.x)/2, y=y, z=minp.z+(maxp.z-minp.z)/2}
|
local p = {x=minp.x+(maxp.x-minp.x)/2, y=y, z=minp.z+(maxp.z-minp.z)/2}
|
||||||
-- Haupthöhle und alle weiteren
|
-- Haupthöhle und alle weiteren
|
||||||
-- Corridors; starting with main cave out of dirt
|
-- Corridors; starting with main cave out of dirt
|
||||||
|
|
Loading…
Reference in a new issue