[mapgen] [mcl_ocean_monument] Support ice

This commit is contained in:
kay27 2021-05-04 03:27:35 +04:00
parent 66d1172852
commit 9e3c2fe21e
1 changed files with 10 additions and 7 deletions

View File

@ -4,7 +4,7 @@ local minetest_place_schematic = minetest.place_schematic
local minetest_pos_to_string = minetest.pos_to_string local minetest_pos_to_string = minetest.pos_to_string
local path = minetest.get_modpath("mcl_ocean_monument") .. "/schematics/ocean_monument.mts" local path = minetest.get_modpath("mcl_ocean_monument") .. "/schematics/ocean_monument.mts"
local water, air = "mcl_core:water_source", "air" local water, air, ice = "mcl_core:water_source", "air", "mcl_core:ice"
mcl_mapgen.register_chunk_generator(function(minp, maxp, seed) mcl_mapgen.register_chunk_generator(function(minp, maxp, seed)
local minp = minp local minp = minp
@ -14,16 +14,19 @@ mcl_mapgen.register_chunk_generator(function(minp, maxp, seed)
local x, z = minp.x, minp.z local x, z = minp.x, minp.z
local pr = PseudoRandom(seed) local pr = PseudoRandom(seed)
for i = 1, pr:next(10,100) do for i = 1, pr:next(10,100) do
if mcl_mapgen_get_far_node({x=pr:next(0,79)+x, y=1, z=pr:next(0,79)+z}).name ~= water then return end local pos = {x=pr:next(0,79)+x, y=1, z=pr:next(0,79)+z}
local node_name = mcl_mapgen_get_far_node(pos).name
if node_name ~= water and node_name ~= ice then return end
end end
for i = 1, pr:next(10,100) do for i = 1, pr:next(10,100) do
if mcl_mapgen_get_far_node({x=pr:next(0,79)+x, y=2, z=pr:next(0,79)+z}).name ~= air then return end local pos = {x=pr:next(0,79)+x, y=2, z=pr:next(0,79)+z}
local node_name = mcl_mapgen_get_far_node(pos).name
if node_name ~= air then return end
end end
for i = 1, pr:next(10,100) do for i = 1, pr:next(10,100) do
if mcl_mapgen_get_far_node({x=pr:next(15,64)+x, y=pr:next(0,25)-25, z=pr:next(15,64)+z}).name ~= water then local pos = {x=pr:next(15,64)+x, y=pr:next(0,25)-25, z=pr:next(15,64)+z}
-- minetest_log("warning", "[mcl_ocean_monument] Not water at " .. minetest_pos_to_string(minp)) local node_name = mcl_mapgen_get_far_node(pos).name
return if node_name ~= water then return end
end
end end
-- minetest_place_schematic(minp, path, tostring(pr:next(0,3)*90), nil, true) -- minetest_place_schematic(minp, path, tostring(pr:next(0,3)*90), nil, true)