diff --git a/mods/CORE/mcl_mapgen/init.lua b/mods/CORE/mcl_mapgen/init.lua index 9c6fb8a11..a5982ae4e 100644 --- a/mods/CORE/mcl_mapgen/init.lua +++ b/mods/CORE/mcl_mapgen/init.lua @@ -1,5 +1,9 @@ mcl_mapgen = {} +local priority = { + OCEAN_MONUMENT = 1000000 +} + local math_floor = math.floor local math_max = math.max local minetest_get_node = minetest.get_node @@ -398,3 +402,5 @@ mcl_mapgen.dungeons = normal mcl_mapgen.overworld = overworld mcl_mapgen.end_ = end_ mcl_mapgen.nether = nether + +mcl_mapgen.priorities = priority diff --git a/mods/MAPGEN/mcl_ocean_monument/init.lua b/mods/MAPGEN/mcl_ocean_monument/init.lua new file mode 100644 index 000000000..135e315bd --- /dev/null +++ b/mods/MAPGEN/mcl_ocean_monument/init.lua @@ -0,0 +1,36 @@ +local mcl_mapgen_get_far_node = mcl_mapgen.get_far_node +local minetest_log = minetest.log +local minetest_place_schematic = minetest.place_schematic +local minetest_pos_to_string = minetest.pos_to_string + +local path = minetest.get_modpath("mcl_ocean_monument") .. "/schematics/ocean_monument.mts" +local water, air = "mcl_core:water_source", "air" + +mcl_mapgen.register_chunk_generator(function(minp, maxp, seed) + local minp = minp + local y = minp.y + if y ~= -32 then return end + + local x, z = minp.x, minp.z + local pr = PseudoRandom(seed) + 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 + end + 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 + end + 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 +-- minetest_log("warning", "[mcl_ocean_monument] Not water at " .. minetest_pos_to_string(minp)) + return + end + end + +-- 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)) + + ---- TODO: SET UP SPECIAL NODES... + +end, mcl_mapgen.priorities.OCEAN_MONUMENT) diff --git a/mods/MAPGEN/mcl_ocean_monument/mod.conf b/mods/MAPGEN/mcl_ocean_monument/mod.conf new file mode 100644 index 000000000..62648e987 --- /dev/null +++ b/mods/MAPGEN/mcl_ocean_monument/mod.conf @@ -0,0 +1,4 @@ +name = mcl_ocean_monument +author = Sister of epCode +description = Adds Ocean Monument, https://git.minetest.land/MineClone2/MineClone2/issues/958#issuecomment-14102 +depends = mcl_mapgen, mcl_structures diff --git a/mods/MAPGEN/mcl_ocean_monument/schematics/ocean_monument.mts b/mods/MAPGEN/mcl_ocean_monument/schematics/ocean_monument.mts new file mode 100644 index 000000000..f94b808b5 Binary files /dev/null and b/mods/MAPGEN/mcl_ocean_monument/schematics/ocean_monument.mts differ diff --git a/mods/MAPGEN/mcl_villages/init.lua b/mods/MAPGEN/mcl_villages/init.lua index 2b7109451..6e30f7b1c 100644 --- a/mods/MAPGEN/mcl_villages/init.lua +++ b/mods/MAPGEN/mcl_villages/init.lua @@ -93,6 +93,7 @@ if mg_name ~= "singlenode" then local x = pr1:next(0, 40) + minp.x + 19 local z = pr1:next(0, 40) + minp.z + 19 local y = minetest_get_spawn_level(x, z) + if not y then return end if y < (min or y+1) then min = y end if y > (max or y-1) then max = y end end