[mapgen] Fix old-style API calls, make the code runnable

This commit is contained in:
kay27 2021-04-26 20:14:36 +04:00
parent 3732097ed6
commit 269e560db1
3 changed files with 6 additions and 8 deletions

View File

@ -66,8 +66,10 @@ local init_strongholds = function()
strongholds_inited = true
end
init_strongholds()
-- Stronghold generation for register_on_generated.
local generate_strongholds = function(minp, maxp, blockseed)
mcl_mapgen.register_chunk_generator(function(minp, maxp, blockseed)
local pr = PseudoRandom(blockseed)
for s=1, #strongholds do
if not strongholds[s].generated then
@ -99,8 +101,4 @@ local generate_strongholds = function(minp, maxp, blockseed)
end
end
end
end
init_strongholds()
mcl_mapgen_core.register_generator("strongholds", nil, generate_strongholds, 999999)
end, 999999)

View File

@ -78,7 +78,7 @@ end
-- Disable natural generation in singlenode.
local mg_name = minetest.get_mapgen_setting("mg_name")
if mg_name ~= "singlenode" then
mcl_mapgen_core.register_generator("villages", nil, function(minp, maxp, blockseed)
mcl_mapgen.register_chunk_generator(function(minp, maxp, blockseed)
-- don't build settlement underground
if maxp.y < 0 then return end
-- randomly try to build settlements

View File

@ -1089,7 +1089,7 @@ local function create_corridor_system(main_cave_coords)
end
-- The rail corridor algorithm starts here
mcl_mapgen_core.register_generator("railcorridors", nil, function(minp, maxp, blockseed, _pr)
mcl_mapgen.register_chunk_generator(function(minp, maxp, blockseed, _pr)
-- We re-init the randomizer for every mapchunk as we start generating in the middle of each mapchunk.
-- We can't use the mapgen seed as this would make the algorithm depending on the order the mapchunk generate.
InitRandomizer(blockseed)