Merge master into testing

This commit is contained in:
kay27 2022-01-10 19:38:12 +04:00
commit f207832c5a
3 changed files with 461 additions and 409 deletions

View File

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

View File

@ -28,7 +28,9 @@ minetest.register_alias("mapgen_clay", "mcl_core:clay")
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_mossycobble", "mcl_core:mossycobble")
if minetest.get_modpath("mcl_flowers") then
minetest.register_alias("mapgen_junglegrass", "mcl_flowers:fern")
end
minetest.register_alias("mapgen_stone_with_coal", "mcl_core:stone_with_coal")
minetest.register_alias("mapgen_stone_with_iron", "mcl_core:stone_with_iron")
minetest.register_alias("mapgen_desert_sand", "mcl_core:sand")
@ -43,11 +45,14 @@ minetest.register_alias("mapgen_snow", "mcl_core:snow")
minetest.register_alias("mapgen_snowblock", "mcl_core:snowblock")
minetest.register_alias("mapgen_ice", "mcl_core:ice")
minetest.register_alias("mapgen_stair_cobble", "mcl_stairs:stair_cobble")
minetest.register_alias("mapgen_sandstonebrick", "mcl_core:sandstonesmooth")
if minetest.get_modpath("mcl_stairs") then
minetest.register_alias("mapgen_stair_cobble", "mcl_stairs:stair_cobble")
minetest.register_alias("mapgen_stair_sandstonebrick", "mcl_stairs:stair_sandstone")
minetest.register_alias("mapgen_stair_sandstone_block", "mcl_stairs:stair_sandstone")
minetest.register_alias("mapgen_stair_desert_stone", "mcl_stairs:stair_sandstone")
end
local mg_name = minetest.get_mapgen_setting("mg_name")
local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true"
@ -69,9 +74,16 @@ local c_sand = minetest.get_content_id("mcl_core:sand")
local c_void = minetest.get_content_id("mcl_core:void")
local c_lava = minetest.get_content_id("mcl_core:lava_source")
local c_water = minetest.get_content_id("mcl_core:water_source")
local c_soul_sand = minetest.get_content_id("mcl_nether:soul_sand")
local c_netherrack = minetest.get_content_id("mcl_nether:netherrack")
local c_nether_lava = minetest.get_content_id("mcl_nether:nether_lava_source")
local c_nether = nil
if minetest.get_modpath("mcl_nether") then
c_nether = {
soul_sand = minetest.get_content_id("mcl_nether:soul_sand"),
netherrack = minetest.get_content_id("mcl_nether:netherrack"),
lava = minetest.get_content_id("mcl_nether:nether_lava_source")
}
end
--local c_end_stone = minetest.get_content_id("mcl_end:end_stone")
local c_realm_barrier = minetest.get_content_id("mcl_core:realm_barrier")
local c_top_snow = minetest.get_content_id("mcl_core:snow")
@ -80,12 +92,18 @@ local c_clay = minetest.get_content_id("mcl_core:clay")
local c_leaves = minetest.get_content_id("mcl_core:leaves")
local c_jungleleaves = minetest.get_content_id("mcl_core:jungleleaves")
--local c_jungletree = minetest.get_content_id("mcl_core:jungletree")
local c_cocoa_1 = minetest.get_content_id("mcl_cocoas:cocoa_1")
local c_cocoa_2 = minetest.get_content_id("mcl_cocoas:cocoa_2")
local c_cocoa_3 = minetest.get_content_id("mcl_cocoas:cocoa_3")
local c_vine = minetest.get_content_id("mcl_core:vine")
local c_air = minetest.CONTENT_AIR
local c_cocoas = nil
if minetest.get_modpath("mcl_cocoas") then
c_cocoas = {
minetest.get_content_id("mcl_cocoas:cocoa_1"),
minetest.get_content_id("mcl_cocoas:cocoa_2"),
minetest.get_content_id("mcl_cocoas:cocoa_3")
}
end
--
-- Ore generation
--
@ -710,6 +728,13 @@ local function register_mgv6_decorations()
num_spawn_by = 1,
})
-- Hack to make sure certain items only spawn in jungles
local spawn_by_in_jungle = { "mcl_core:jungletree" }
if minetest.get_modpath("mcl_flowers") then
table.insert(spawn_by_in_jungle, "mcl_flowers:fern")
end
if minetest.get_modpath("mcl_flowers") then
-- Doubletall grass
minetest.register_decoration({
deco_type = "schematic",
@ -747,7 +772,7 @@ local function register_mgv6_decorations()
},
},
-- v6 hack: This makes sure large ferns only appear in jungles
spawn_by = { "mcl_core:jungletree", "mcl_flowers:fern" },
spawn_by = spawn_by_in_jungle,
num_spawn_by = 1,
place_on = {"group:grass_block_no_snow"},
@ -823,7 +848,9 @@ local function register_mgv6_decorations()
y_max = 0,
rotation = "random",
})
end
if minetest.get_modpath("mcl_farming") then
-- Pumpkin
minetest.register_decoration({
deco_type = "simple",
@ -858,14 +885,16 @@ local function register_mgv6_decorations()
persist = 0.6
},
-- Small trick to make sure melon spawn in jungles
spawn_by = { "mcl_core:jungletree", "mcl_flowers:fern" },
spawn_by = spawn_by_in_jungle,
num_spawn_by = 1,
y_min = 1,
y_max = 40,
decoration = "mcl_farming:melon",
})
end
-- Tall grass
if minetest.get_modpath("mcl_flowers") then
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_no_snow"},
@ -898,8 +927,10 @@ local function register_mgv6_decorations()
y_max = mcl_vars.overworld_max,
decoration = "mcl_flowers:tallgrass",
})
end
-- Seagrass and kelp
if minetest.get_modpath("mcl_ocean") then
local materials = {"dirt","sand"}
for i=1, #materials do
local mat = materials[i]
@ -989,11 +1020,12 @@ local function register_mgv6_decorations()
param2 = 32,
param2_max = 160,
})
end
end
-- Wet Sponge
-- TODO: Remove this when we got ocean monuments
if minetest.get_modpath("mcl_sponges") then
minetest.register_decoration({
deco_type = "simple",
decoration = "mcl_sponges:sponge_wet",
@ -1013,8 +1045,10 @@ local function register_mgv6_decorations()
y_min = mcl_vars.mg_lava_overworld_max + 5,
y_max = -20,
})
end
-- Add a small amount of tall grass everywhere to avoid areas completely empty devoid of tall grass
if minetest.get_modpath("mcl_flowers") then
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_no_snow"},
@ -1024,7 +1058,9 @@ local function register_mgv6_decorations()
y_max = mcl_vars.overworld_max,
decoration = "mcl_flowers:tallgrass",
})
end
if minetest.get_modpath("mcl_mushrooms") then
local mushrooms = {"mcl_mushrooms:mushroom_red", "mcl_mushrooms:mushroom_brown"}
local mseeds = { 7133, 8244 }
for m=1, #mushrooms do
@ -1048,6 +1084,7 @@ local function register_mgv6_decorations()
num_spawn_by = 1,
})
end
end
-- Dead bushes
minetest.register_decoration({
@ -1067,6 +1104,7 @@ local function register_mgv6_decorations()
decoration = "mcl_core:deadbush",
})
if minetest.get_modpath("mcl_flowers") then
local function register_mgv6_flower(name, seed, offset, y_max)
if offset == nil then
offset = 0
@ -1107,6 +1145,7 @@ local function register_mgv6_decorations()
register_mgv6_flower("blue_orchid", 64500, nil, mcl_worlds.layer_to_y(67))
register_mgv6_flower("oxeye_daisy", 3490)
register_mgv6_flower("poppy", 9439)
end
-- Put top snow on snowy grass blocks. The v6 mapgen does not generate the top snow on its own.
minetest.register_decoration({
@ -1288,6 +1327,10 @@ end
-- TODO: Try to use more efficient structure generating code
local function generate_structures(minp, maxp, blockseed, biomemap)
if mcl_structures == nil then
return
end
local chunk_has_desert_well = false
local chunk_has_desert_temple = false
local chunk_has_igloo = false
@ -1596,6 +1639,7 @@ local function generate_tree_decorations(minp, maxp, seed, data, param2_data, ar
local pos, treepos, dir
if c_cocoas ~= nil then
local cocoachance = 40
if dense_vegetation then
cocoachance = 32
@ -1628,17 +1672,11 @@ local function generate_tree_decorations(minp, maxp, seed, data, param2_data, ar
and data[p_pos] == c_air
and l and l > 12 then
local c = pr:next(1, 3)
if c == 1 then
data[p_pos] = c_cocoa_1
elseif c == 2 then
data[p_pos] = c_cocoa_2
else
data[p_pos] = c_cocoa_3
end
data[p_pos] = c_cocoas[c]
param2_data[p_pos] = minetest.dir_to_facedir(vector.subtract(treepos, pos))
lvm_used = true
end
end
end
end
@ -1748,6 +1786,10 @@ end
-- Generate mushrooms in caves manually.
-- Minetest's API does not support decorations in caves yet. :-(
local function generate_underground_mushrooms(minp, maxp, seed)
if not minetest.get_modpath("mcl_mushrooms") then
return
end
local pr_shroom = PseudoRandom(seed-24359)
-- Generate rare underground mushrooms
-- TODO: Make them appear in groups, use Perlin noise
@ -1782,6 +1824,10 @@ end
-- Generate Nether decorations manually: Eternal fire, mushrooms, nether wart
-- Minetest's API does not support decorations in caves yet. :-(
local function generate_nether_decorations(minp, maxp, seed)
if c_nether == nil then
return
end
local pr_nether = PseudoRandom(seed+667)
if minp.y > mcl_vars.mg_nether_max or maxp.y < mcl_vars.mg_nether_min then
@ -1824,6 +1870,7 @@ local function generate_nether_decorations(minp, maxp, seed)
-- Mushrooms on netherrack
-- Note: Spawned *after* the fire because of light level checks
if minetest.get_modpath("mcl_mushrooms") then
special_deco(rack, function(bpos)
local l = minetest.get_node_light(bpos, 0.5)
if bpos.y > mcl_vars.mg_lava_nether_max + 6 and l and l <= 12 and pr_nether:next(1,1000) <= 4 then
@ -1835,6 +1882,7 @@ local function generate_nether_decorations(minp, maxp, seed)
end
end
end)
end
-- Nether wart on soul sand
-- TODO: Spawn in Nether fortresses
@ -2047,7 +2095,9 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- Big lava seas by replacing air below a certain height
if mcl_vars.mg_lava then
lvm_used = set_layers(data, area, c_lava, c_air, mcl_vars.mg_overworld_min, mcl_vars.mg_lava_overworld_max, emin, emax, lvm_used, pr)
lvm_used = set_layers(data, area, c_nether_lava, c_air, mcl_vars.mg_nether_min, mcl_vars.mg_lava_nether_max, emin, emax, lvm_used, pr)
if c_nether then
lvm_used = set_layers(data, area, c_nether.lava, c_air, mcl_vars.mg_nether_min, mcl_vars.mg_lava_nether_max, emin, emax, lvm_used, pr)
end
end
-- Clay, vines, cocoas
@ -2129,25 +2179,27 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- * Replace water with Nether lava.
-- * Replace stone, sand dirt in v6 so the Nether works in v6.
elseif emin.y <= mcl_vars.mg_nether_max and emax.y >= mcl_vars.mg_nether_min then
if c_nether then
if mg_name == "v6" then
local nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
for n=1, #nodes do
local p_pos = area:index(nodes[n].x, nodes[n].y, nodes[n].z)
if data[p_pos] == c_water then
data[p_pos] = c_nether_lava
data[p_pos] = c_nether.lava
lvm_used = true
elseif data[p_pos] == c_stone then
data[p_pos] = c_netherrack
data[p_pos] = c_nether.netherrack
lvm_used = true
elseif data[p_pos] == c_sand or data[p_pos] == c_dirt then
data[p_pos] = c_soul_sand
data[p_pos] = c_nether.soul_sand
lvm_used = true
end
end
else
local nodes = minetest.find_nodes_in_area(emin, emax, {"group:water"})
for _, n in pairs(nodes) do
data[area:index(n.x, n.y, n.z)] = c_nether_lava
data[area:index(n.x, n.y, n.z)] = c_nether.lava
end
end
end

View File

@ -1,5 +1,5 @@
name = mcl_mapgen_core
author = Wuzzy
description = The core of the MCL2 mapgen
depends = mcl_init, mcl_core, biomeinfo, mcl_worlds, mcl_cocoas, mcl_sponges, mcl_ocean, mcl_stairs, mcl_monster_eggs, mcl_structures
optional_depends = mclx_core
depends = mcl_init, mcl_core, biomeinfo, mcl_worlds
optional_depends = mclx_core, mcl_cocoas, mcl_sponges, mcl_ocean, mcl_stairs, mcl_monster_eggs, mcl_structures, mcl_flowers, mcl_farming, mcl_mushrooms, mcl_nether