[mapgen] [mcl_ocean_monument] Reorder check loops to make it work faster, add random rotation

This commit is contained in:
kay27 2021-05-06 00:41:20 +04:00
parent 2fda0f2644
commit 2272753652
1 changed files with 9 additions and 7 deletions

View File

@ -1,3 +1,6 @@
-- Check it: `/tp 14958,8,11370` @ world seed `1`
local mcl_mapgen_get_far_node = mcl_mapgen.get_far_node local mcl_mapgen_get_far_node = mcl_mapgen.get_far_node
local minetest_log = minetest.log local minetest_log = minetest.log
local minetest_place_schematic = minetest.place_schematic local minetest_place_schematic = minetest.place_schematic
@ -14,9 +17,9 @@ 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
local pos = {x=pr:next(0,79)+x, y=1, z=pr:next(0,79)+z} local pos = {x=pr:next(15,64)+x, y=pr:next(0,25)-25, z=pr:next(15,64)+z}
local node_name = mcl_mapgen_get_far_node(pos).name local node_name = mcl_mapgen_get_far_node(pos).name
if node_name ~= water and node_name ~= ice then return end if node_name ~= water then return end
end end
for i = 1, pr:next(10,100) do for i = 1, pr:next(10,100) do
local pos = {x=pr:next(0,79)+x, y=2, z=pr:next(0,79)+z} local pos = {x=pr:next(0,79)+x, y=2, z=pr:next(0,79)+z}
@ -24,16 +27,15 @@ mcl_mapgen.register_chunk_generator(function(minp, maxp, seed)
if node_name ~= air then return end 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
local pos = {x=pr:next(15,64)+x, y=pr:next(0,25)-25, z=pr:next(15,64)+z} 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 local node_name = mcl_mapgen_get_far_node(pos).name
if node_name ~= water then return end if node_name ~= water and node_name ~= ice then return 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)
minetest_place_schematic(minp, path, 0, nil, true)
minetest_log("action", "[mcl_ocean_monument] Placed at " .. minetest_pos_to_string(minp)) minetest_log("action", "[mcl_ocean_monument] Placed at " .. minetest_pos_to_string(minp))
---- TODO: SET UP SPECIAL NODES... ---- TODO: SET UP SOME NODES?
end, mcl_mapgen.priorities.OCEAN_MONUMENT) end, mcl_mapgen.priorities.OCEAN_MONUMENT)