mcl_mapgen_core: Make mcl_nether an optional dependency.

mcl_nether 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:55:33 +00:00
parent a0708abb9c
commit 802d214d7b
2 changed files with 38 additions and 23 deletions

View File

@ -74,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_void = minetest.get_content_id("mcl_core:void")
local c_lava = minetest.get_content_id("mcl_core:lava_source") local c_lava = minetest.get_content_id("mcl_core:lava_source")
local c_water = minetest.get_content_id("mcl_core:water_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 = nil
local c_nether_lava = minetest.get_content_id("mcl_nether:nether_lava_source") 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_end_stone = minetest.get_content_id("mcl_end:end_stone")
local c_realm_barrier = minetest.get_content_id("mcl_core:realm_barrier") local c_realm_barrier = minetest.get_content_id("mcl_core:realm_barrier")
local c_top_snow = minetest.get_content_id("mcl_core:snow") local c_top_snow = minetest.get_content_id("mcl_core:snow")
@ -1792,6 +1799,10 @@ end
-- Generate Nether decorations manually: Eternal fire, mushrooms, nether wart -- Generate Nether decorations manually: Eternal fire, mushrooms, nether wart
-- Minetest's API does not support decorations in caves yet. :-( -- Minetest's API does not support decorations in caves yet. :-(
local function generate_nether_decorations(minp, maxp, seed) local function generate_nether_decorations(minp, maxp, seed)
if c_nether == nil then
return
end
local pr_nether = PseudoRandom(seed+667) local pr_nether = PseudoRandom(seed+667)
if minp.y > mcl_vars.mg_nether_max or maxp.y < mcl_vars.mg_nether_min then if minp.y > mcl_vars.mg_nether_max or maxp.y < mcl_vars.mg_nether_min then
@ -2059,7 +2070,9 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- Big lava seas by replacing air below a certain height -- Big lava seas by replacing air below a certain height
if mcl_vars.mg_lava then 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_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 end
-- Clay, vines, cocoas -- Clay, vines, cocoas
@ -2141,25 +2154,27 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- * Replace water with Nether lava. -- * Replace water with Nether lava.
-- * Replace stone, sand dirt in v6 so the Nether works in v6. -- * 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 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 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"}) 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 for n=1, #nodes do
local p_pos = area:index(nodes[n].x, nodes[n].y, nodes[n].z) local p_pos = area:index(nodes[n].x, nodes[n].y, nodes[n].z)
if data[p_pos] == c_water then if data[p_pos] == c_water then
data[p_pos] = c_nether_lava data[p_pos] = c_nether.lava
lvm_used = true lvm_used = true
elseif data[p_pos] == c_stone then elseif data[p_pos] == c_stone then
data[p_pos] = c_netherrack data[p_pos] = c_nether.netherrack
lvm_used = true lvm_used = true
elseif data[p_pos] == c_sand or data[p_pos] == c_dirt then 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 lvm_used = true
end end
end end
else else
local nodes = minetest.find_nodes_in_area(emin, emax, {"group:water"}) local nodes = minetest.find_nodes_in_area(emin, emax, {"group:water"})
for _, n in pairs(nodes) do 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
end end

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, mcl_mushrooms 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