mcl_mapgen_core: Make mcl_mushrooms an optional dependency.

mcl_mushrooms was previously an undeclared dependency of mcl_mapgen_core.
Now it is both optional and declared.
This commit is contained in:
Daniel Cassidy 2022-01-06 02:46:02 +00:00
parent 554f22b802
commit a0708abb9c
2 changed files with 41 additions and 33 deletions

View File

@ -1053,28 +1053,30 @@ local function register_mgv6_decorations()
}) })
end end
local mushrooms = {"mcl_mushrooms:mushroom_red", "mcl_mushrooms:mushroom_brown"} if minetest.get_modpath("mcl_mushrooms") then
local mseeds = { 7133, 8244 } local mushrooms = {"mcl_mushrooms:mushroom_red", "mcl_mushrooms:mushroom_brown"}
for m=1, #mushrooms do local mseeds = { 7133, 8244 }
-- Mushrooms next to trees for m=1, #mushrooms do
minetest.register_decoration({ -- Mushrooms next to trees
deco_type = "simple", minetest.register_decoration({
place_on = {"group:grass_block_no_snow", "mcl_core:dirt", "mcl_core:podzol", "mcl_core:mycelium", "mcl_core:stone", "mcl_core:andesite", "mcl_core:diorite", "mcl_core:granite"}, deco_type = "simple",
sidelen = 16, place_on = {"group:grass_block_no_snow", "mcl_core:dirt", "mcl_core:podzol", "mcl_core:mycelium", "mcl_core:stone", "mcl_core:andesite", "mcl_core:diorite", "mcl_core:granite"},
noise_params = { sidelen = 16,
offset = 0.04, noise_params = {
scale = 0.04, offset = 0.04,
spread = {x = 100, y = 100, z = 100}, scale = 0.04,
seed = mseeds[m], spread = {x = 100, y = 100, z = 100},
octaves = 3, seed = mseeds[m],
persist = 0.6 octaves = 3,
}, persist = 0.6
y_min = 1, },
y_max = mcl_vars.mg_overworld_max, y_min = 1,
decoration = mushrooms[m], y_max = mcl_vars.mg_overworld_max,
spawn_by = { "mcl_core:tree", "mcl_core:sprucetree", "mcl_core:darktree", "mcl_core:birchtree", }, decoration = mushrooms[m],
num_spawn_by = 1, spawn_by = { "mcl_core:tree", "mcl_core:sprucetree", "mcl_core:darktree", "mcl_core:birchtree", },
}) num_spawn_by = 1,
})
end
end end
-- Dead bushes -- Dead bushes
@ -1752,6 +1754,10 @@ end
-- Generate mushrooms in caves manually. -- Generate mushrooms in caves manually.
-- Minetest's API does not support decorations in caves yet. :-( -- Minetest's API does not support decorations in caves yet. :-(
local function generate_underground_mushrooms(minp, maxp, seed) local function generate_underground_mushrooms(minp, maxp, seed)
if not minetest.get_modpath("mcl_mushrooms") then
return
end
local pr_shroom = PseudoRandom(seed-24359) local pr_shroom = PseudoRandom(seed-24359)
-- Generate rare underground mushrooms -- Generate rare underground mushrooms
-- TODO: Make them appear in groups, use Perlin noise -- TODO: Make them appear in groups, use Perlin noise
@ -1828,17 +1834,19 @@ local function generate_nether_decorations(minp, maxp, seed)
-- Mushrooms on netherrack -- Mushrooms on netherrack
-- Note: Spawned *after* the fire because of light level checks -- Note: Spawned *after* the fire because of light level checks
special_deco(rack, function(bpos) if minetest.get_modpath("mcl_mushrooms") then
local l = minetest.get_node_light(bpos, 0.5) special_deco(rack, function(bpos)
if bpos.y > mcl_vars.mg_lava_nether_max + 6 and l and l <= 12 and pr_nether:next(1,1000) <= 4 then local l = minetest.get_node_light(bpos, 0.5)
-- TODO: Make mushrooms appear in groups, use Perlin noise if bpos.y > mcl_vars.mg_lava_nether_max + 6 and l and l <= 12 and pr_nether:next(1,1000) <= 4 then
if pr_nether:next(1,2) == 1 then -- TODO: Make mushrooms appear in groups, use Perlin noise
minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_brown"}) if pr_nether:next(1,2) == 1 then
else minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_brown"})
minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_red"}) else
minetest.set_node(bpos, {name = "mcl_mushrooms:mushroom_red"})
end
end end
end end)
end) end
-- Nether wart on soul sand -- Nether wart on soul sand
-- TODO: Spawn in Nether fortresses -- TODO: Spawn in Nether fortresses

View File

@ -2,4 +2,4 @@ name = mcl_mapgen_core
author = Wuzzy author = Wuzzy
description = The core of the MCL2 mapgen description = The core of the MCL2 mapgen
depends = mcl_init, mcl_core, biomeinfo, mcl_worlds 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 optional_depends = mclx_core, mcl_cocoas, mcl_sponges, mcl_ocean, mcl_stairs, mcl_monster_eggs, mcl_structures, mcl_flowers, mcl_farming, mcl_mushrooms