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,6 +1053,7 @@ local function register_mgv6_decorations()
}) })
end end
if minetest.get_modpath("mcl_mushrooms") then
local mushrooms = {"mcl_mushrooms:mushroom_red", "mcl_mushrooms:mushroom_brown"} local mushrooms = {"mcl_mushrooms:mushroom_red", "mcl_mushrooms:mushroom_brown"}
local mseeds = { 7133, 8244 } local mseeds = { 7133, 8244 }
for m=1, #mushrooms do for m=1, #mushrooms do
@ -1076,6 +1077,7 @@ local function register_mgv6_decorations()
num_spawn_by = 1, num_spawn_by = 1,
}) })
end end
end
-- Dead bushes -- Dead bushes
minetest.register_decoration({ minetest.register_decoration({
@ -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,6 +1834,7 @@ 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
if minetest.get_modpath("mcl_mushrooms") then
special_deco(rack, function(bpos) special_deco(rack, function(bpos)
local l = minetest.get_node_light(bpos, 0.5) 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 if bpos.y > mcl_vars.mg_lava_nether_max + 6 and l and l <= 12 and pr_nether:next(1,1000) <= 4 then
@ -1839,6 +1846,7 @@ local function generate_nether_decorations(minp, maxp, seed)
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