Compare commits

...

10 Commits

8 changed files with 148 additions and 40 deletions

View File

@ -26,10 +26,12 @@ mcl_vars.tool_wield_scale = { x = 1.8, y = 1.8, z = 1 }
-- Mapgen variables -- Mapgen variables
local mg_name = minetest.get_mapgen_setting("mg_name") local mg_name = minetest.get_mapgen_setting("mg_name")
local minecraft_height_limit = 256 local minecraft_height_limit = 320
local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true" local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true"
local singlenode = mg_name == "singlenode" local singlenode = mg_name == "singlenode"
local convert_old_bedrock = minetest.settings:get_bool("mcl_convert_old_bedrock", true)
-- Calculate mapgen_edge_min/mapgen_edge_max -- Calculate mapgen_edge_min/mapgen_edge_max
mcl_vars.chunksize = math.max(1, tonumber(minetest.get_mapgen_setting("chunksize")) or 5) mcl_vars.chunksize = math.max(1, tonumber(minetest.get_mapgen_setting("chunksize")) or 5)
mcl_vars.MAP_BLOCKSIZE = math.max(1, minetest.MAP_BLOCKSIZE or 16) mcl_vars.MAP_BLOCKSIZE = math.max(1, minetest.MAP_BLOCKSIZE or 16)
@ -99,7 +101,10 @@ if not superflat and not singlenode then
]] ]]
-- Overworld -- Overworld
mcl_vars.mg_overworld_min = -62 local mg_overworld_min_default = -128
mcl_vars.mg_overworld_min_old = -62
mcl_vars.mg_overworld_min = tonumber(minetest.settings:get("mcl_overworld_min")) or mg_overworld_min_default
mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit 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_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
@ -108,7 +113,8 @@ if not superflat and not singlenode then
mcl_vars.mg_bedrock_is_rough = true mcl_vars.mg_bedrock_is_rough = true
elseif singlenode then elseif singlenode then
mcl_vars.mg_overworld_min = -66 mcl_vars.mg_overworld_min_old = -66
mcl_vars.mg_overworld_min = -130
mcl_vars.mg_overworld_max_official = mcl_vars.mg_overworld_min + minecraft_height_limit 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_min = mcl_vars.mg_overworld_min
mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min mcl_vars.mg_bedrock_overworld_max = mcl_vars.mg_bedrock_overworld_min
@ -262,3 +268,57 @@ function mcl_vars.get_node(p, force, us_timeout)
return node return node
-- it still can return "ignore", LOL, even if force = true, but only after time out -- it still can return "ignore", LOL, even if force = true, but only after time out
end end
-- Abm to update from old mapgen depth to new. potentially affects a lot of nodes inducing lag.
-- Also it will not generate ores or bedrock pattern.
local adjacents = {
vector.new(1,0,0),
vector.new(0,1,0),
vector.new(0,0,1),
vector.new(-1,0,0),
vector.new(0,-1,0),
vector.new(0,0,-1),
}
local function register_abms()
minetest.register_abm({
label = "Replace bedrock from old bedrock layer and air/void below to deepslate",
name = ":mcl_mapgen_core:replace_old_void",
nodenames = { "mcl_core:void" },
chance = 1,
interval = 5,
min_y = mcl_vars.mg_bedrock_overworld_max,
max_y = mcl_vars.mg_overworld_min_old,
action = function(p)
minetest.log("void")
if p.y > mcl_vars.mg_overworld_min_old - 5 then
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.new(p.x-5,mcl_vars.mg_overworld_min_old-5,p.z-5),vector.new(p.x+5,mcl_vars.mg_overworld_min_old,p.z+5),{"mcl_core:void"}),{name="mcl_deepslate:deepslate"})
else
minetest.after(0,function(p)
if minetest.get_node(p).name == "mcl_core:void" then
minetest.delete_area(p,p)
end
end,p)
end
end
})
minetest.register_abm({
label = "Replace bedrock from old bedrock layer and air/void below to deepslate",
name = ":mcl_mapgen_core:replace_old_bedrock",
nodenames = { "mcl_core:bedrock" },
chance = 5,
interval = 5,
min_y = mcl_vars.mg_overworld_min_old,
max_y = mcl_vars.mg_overworld_min_old + 4,
action = function(p)
minetest.log("bedr")
if minetest.find_node_near(p,24,{"mcl_core:void"}) then
return
end
minetest.bulk_set_node(minetest.find_nodes_in_area(vector.new(p.x-5,mcl_vars.mg_overworld_min_old-1,p.z-5),vector.new(p.x+5,mcl_vars.mg_overworld_min_old+5,p.z+5),{"mcl_core:bedrock",}),{name="mcl_deepslate:deepslate"})
end
})
end
if convert_old_bedrock then
register_abms()
end

View File

@ -36,7 +36,7 @@ end
-- nil, "void" -- nil, "void"
function mcl_worlds.y_to_layer(y) function mcl_worlds.y_to_layer(y)
if y >= mcl_vars.mg_overworld_min then if y >= mcl_vars.mg_overworld_min then
return y - mcl_vars.mg_overworld_min, "overworld" return y - mcl_vars.mg_overworld_min_old, "overworld"
elseif y >= mcl_vars.mg_nether_min and y <= mcl_vars.mg_nether_max+128 then elseif y >= mcl_vars.mg_nether_min and y <= mcl_vars.mg_nether_max+128 then
return y - mcl_vars.mg_nether_min, "nether" return y - mcl_vars.mg_nether_min, "nether"
elseif y >= mcl_vars.mg_end_min and y <= mcl_vars.mg_end_max then elseif y >= mcl_vars.mg_end_min and y <= mcl_vars.mg_end_max then
@ -61,13 +61,13 @@ local pos_to_dimension = mcl_worlds.pos_to_dimension
-- MineClone 2. -- MineClone 2.
-- mc_dimension is one of "overworld", "nether", "end" (default: "overworld"). -- mc_dimension is one of "overworld", "nether", "end" (default: "overworld").
function mcl_worlds.layer_to_y(layer, mc_dimension) function mcl_worlds.layer_to_y(layer, mc_dimension)
if mc_dimension == "overworld" or mc_dimension == nil then if mc_dimension == "overworld" or mc_dimension == nil then
return layer + mcl_vars.mg_overworld_min return layer + mcl_vars.mg_overworld_min_old
elseif mc_dimension == "nether" then elseif mc_dimension == "nether" then
return layer + mcl_vars.mg_nether_min return layer + mcl_vars.mg_nether_min
elseif mc_dimension == "end" then elseif mc_dimension == "end" then
return layer + mcl_vars.mg_end_min return layer + mcl_vars.mg_end_min
end end
end end
-- Takes a position and returns true if this position can have weather -- Takes a position and returns true if this position can have weather

View File

@ -42,7 +42,7 @@ local function register_drop(liquid, glow, sound, nodes, interval, chance)
--with longer abm cycles --with longer abm cycles
table.shuffle(nn) table.shuffle(nn)
for i=1,math.random(#nn) do for i=1,math.random(#nn) do
if minetest.get_item_group(minetest.get_node(vector.offset(nn[i], 0, 1, 0)).name, liquid) ~= 0 if nn[i] and minetest.get_item_group(minetest.get_node(vector.offset(nn[i], 0, 1, 0)).name, liquid) ~= 0
and minetest.get_node(vector.offset(nn[i], 0, -1, 0)).name == "air" then and minetest.get_node(vector.offset(nn[i], 0, -1, 0)).name == "air" then
make_drop(nn[i],liquid,sound,interval) make_drop(nn[i],liquid,sound,interval)
end end

View File

@ -1,7 +1,7 @@
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
local mt_sound_play = minetest.sound_play local mt_sound_play = minetest.sound_play
local spread_to = {"mcl_core:stone","mcl_core:dirt","mcl_core:sand","mcl_core:dirt_with_grass","group:grass_block","mcl_core:andesite","mcl_core:diorite","mcl_core:granite","mcl_core:mycelium","group:dirt","mcl_end:end_stone","mcl_nether:netherrack","mcl_blackstone:basalt","mcl_nether:soul_sand","mcl_blackstone:soul_soil","mcl_crimson:warped_nylium","mcl_crimson:crimson_nylium","mcl_core:gravel"} local spread_to = {"mcl_core:stone","mcl_core:dirt","mcl_core:sand","mcl_core:dirt_with_grass","group:grass_block","mcl_core:andesite","mcl_core:diorite","mcl_core:granite","mcl_core:mycelium","group:dirt","mcl_end:end_stone","mcl_nether:netherrack","mcl_blackstone:basalt","mcl_nether:soul_sand","mcl_blackstone:soul_soil","mcl_crimson:warped_nylium","mcl_crimson:crimson_nylium","mcl_core:gravel","mcl_deepslate:deepslate","mcl_deepslate:tuff"}
local sounds = { local sounds = {
footstep = {name = "mcl_sculk_block", }, footstep = {name = "mcl_sculk_block", },

View File

@ -1095,7 +1095,6 @@ local function register_biomes()
_mcl_palette_index = 22, _mcl_palette_index = 22,
}) })
-- Savanna -- Savanna
minetest.register_biome({ minetest.register_biome({
name = "Savanna", name = "Savanna",
@ -1489,6 +1488,33 @@ local function register_biomes()
_mcl_palette_index = 29, _mcl_palette_index = 29,
}) })
minetest.register_biome({
name = "DeepDark",
node_top = "mcl_sculk:sculk",
depth_top = 1,
node_filler = "mcl_deepslate:deepslate",
node_riverbed = "mcl_deepslate:deepslate",
depth_riverbed = 1,
node_stone = "mcl_deepslate:deepslate",
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_vars.mg_overworld_min_old,
humidity_point = 0,
heat_point = 60,
vertical_blend = 8,
_mcl_biome_type = "hot",
_mcl_palette_index = 21,
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:material_stone","mcl_deepslate:deepslate"},
sidelen = 16,
fill_ratio = 10,
biomes = { "DeepDark" },
decoration = "mcl_sculk:sculk",
flags = "all_floors",
param2 = 0,
})
-- Add deep ocean and underground biomes automatically. -- Add deep ocean and underground biomes automatically.
for i=1, #overworld_biomes do for i=1, #overworld_biomes do
local biome = overworld_biomes[i] local biome = overworld_biomes[i]
@ -1517,11 +1543,21 @@ local function register_biomes()
name = biome .. "_underground", name = biome .. "_underground",
heat_point = minetest.registered_biomes[biome].heat_point, heat_point = minetest.registered_biomes[biome].heat_point,
humidity_point = minetest.registered_biomes[biome].humidity_point, humidity_point = minetest.registered_biomes[biome].humidity_point,
y_min = mcl_vars.mg_overworld_min, y_min = mcl_vars.mg_overworld_min_old,
y_max = DEEP_OCEAN_MIN - 1, y_max = DEEP_OCEAN_MIN - 1,
_mcl_biome_type = minetest.registered_biomes[biome]._mcl_biome_type, _mcl_biome_type = minetest.registered_biomes[biome]._mcl_biome_type,
_mcl_palette_index = minetest.registered_biomes[biome]._mcl_palette_index, _mcl_palette_index = minetest.registered_biomes[biome]._mcl_palette_index,
}) })
minetest.register_biome({
name = biome .. "_deep_underground",
heat_point = minetest.registered_biomes[biome].heat_point,
humidity_point = minetest.registered_biomes[biome].humidity_point,
node_stone = "mcl_deepslate:deepslate",
y_min = mcl_vars.mg_overworld_min,
y_max = mcl_vars.mg_overworld_min_old,
_mcl_biome_type = minetest.registered_biomes[biome]._mcl_biome_type,
_mcl_palette_index = minetest.registered_biomes[biome]._mcl_palette_index,
})
end end
end end
@ -2753,6 +2789,16 @@ local function register_coral_decos(ck)
end end
local function register_decorations() local function register_decorations()
--Deep Dark
minetest.register_decoration({
deco_type = "simple",
place_on = {"mcl_sculk:sculk"},
sidelen = 16,
fill_ratio = 0.1,
decoration = "mcl_sculk:catalyst",
biomes = {"DeepDark"},
flags = "all_floors",
})
-- Coral Reefs -- Coral Reefs
for k,_ in pairs(corals) do for k,_ in pairs(corals) do
register_coral_decos(k) register_coral_decos(k)

View File

@ -127,26 +127,25 @@ minetest.register_ore({
} }
}) })
minetest.register_ore({ minetest.register_ore({
ore_type = "blob", ore_type = "blob",
ore = "mcl_deepslate:deepslate", ore = "mcl_deepslate:deepslate",
wherein = { "mcl_core:stone" }, wherein = { "mcl_core:stone" },
clust_scarcity = 200, clust_scarcity = 200,
clust_num_ores = 100, clust_num_ores = 100,
clust_size = 10, clust_size = 10,
y_min = deepslate_min, y_min = mcl_vars.mg_overworld_min_old,
y_max = deepslate_max, y_max = deepslate_max,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = 1, scale = 1,
spread = { x = 250, y = 250, z = 250 }, spread = { x = 250, y = 250, z = 250 },
seed = 12345, seed = 12345,
octaves = 3, octaves = 3,
persist = 0.6, persist = 0.6,
lacunarity = 2, lacunarity = 2,
flags = "defaults", flags = "defaults",
} }
}) })
minetest.register_ore({ minetest.register_ore({
@ -396,7 +395,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
clust_num_ores = 4, clust_num_ores = 4,
clust_size = 3, clust_size = 3,
y_min = mcl_vars.mg_overworld_min, y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(12), y_max = mcl_worlds.layer_to_y(-5),
}) })
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
@ -406,7 +405,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
clust_num_ores = 2, clust_num_ores = 2,
clust_size = 2, clust_size = 2,
y_min = mcl_vars.mg_overworld_min, y_min = mcl_vars.mg_overworld_min,
y_max = mcl_worlds.layer_to_y(12), y_max = mcl_worlds.layer_to_y(-15),
}) })
minetest.register_ore({ minetest.register_ore({
ore_type = "scatter", ore_type = "scatter",
@ -693,9 +692,9 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
{ "iron", 830, 5, 3, deepslate_min, deepslate_max }, { "iron", 830, 5, 3, deepslate_min, deepslate_max },
{ "gold", 4775, 5, 3, deepslate_min, deepslate_max }, { "gold", 4775, 5, 3, deepslate_min, deepslate_max },
{ "gold", 6560, 7, 3, deepslate_min, deepslate_max }, { "gold", 6560, 7, 3, deepslate_min, deepslate_max },
{ "diamond", 10000, 4, 3, deepslate_min, mcl_worlds.layer_to_y(12) }, { "diamond", 10000, 4, 3, deepslate_min, mcl_worlds.layer_to_y(-12) },
{ "diamond", 5000, 2, 3, deepslate_min, mcl_worlds.layer_to_y(12) }, { "diamond", 5000, 2, 3, deepslate_min, mcl_worlds.layer_to_y(-12) },
{ "diamond", 10000, 8, 3, deepslate_min, mcl_worlds.layer_to_y(12) }, { "diamond", 10000, 8, 3, deepslate_min, mcl_worlds.layer_to_y(-5) },
{ "diamond", 20000, 1, 1, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) }, { "diamond", 20000, 1, 1, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
{ "diamond", 20000, 2, 2, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) }, { "diamond", 20000, 2, 2, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
{ "redstone", 500, 4, 3, deepslate_min, mcl_worlds.layer_to_y(13) }, { "redstone", 500, 4, 3, deepslate_min, mcl_worlds.layer_to_y(13) },

View File

@ -49,7 +49,7 @@ local function init_strongholds()
if superflat then if superflat then
y = mcl_vars.mg_bedrock_overworld_max + 3 y = mcl_vars.mg_bedrock_overworld_max + 3
else else
y = pr:next(mcl_vars.mg_bedrock_overworld_max+1, mcl_vars.mg_overworld_min+48) y = pr:next(-50, -30)
end end
local pos = { x = math.cos(angle) * dist, y = y, z = math.sin(angle) * dist } local pos = { x = math.cos(angle) * dist, y = y, z = math.sin(angle) * dist }
pos = vector.round(pos) pos = vector.round(pos)

View File

@ -136,6 +136,9 @@ mcl_default_shadow_intensity (Default shadow intensity) float 0.33 0.0 1.0
# See also: https://github.com/minetest/minetest/issues/95 # See also: https://github.com/minetest/minetest/issues/95
mcl_translucent_ice (Translucent ice) bool false mcl_translucent_ice (Translucent ice) bool false
# Overworld min deep (default: -128)
mcl_overworld_min (Overworld min deep) int -128 -25000 -62
# Whether to generate fallen logs in some biomes. # Whether to generate fallen logs in some biomes.
# They might not always look pretty and have strange overhangs. # They might not always look pretty and have strange overhangs.
mcl_generate_fallen_logs (Generate fallen logs) bool false mcl_generate_fallen_logs (Generate fallen logs) bool false