From 8caf8c91dd7ed0e21e6fd74d32b1a64904fb963b Mon Sep 17 00:00:00 2001 From: kay27 Date: Mon, 17 Jan 2022 06:17:52 +0400 Subject: [PATCH] Add more complex temple spawn conditions --- mods/MAPGEN/mcl_structures/desert_temple.lua | 6 ++++-- mods/MAPGEN/mcl_structures/jungle_temple.lua | 16 +++++++++------- mods/MAPGEN/mcl_structures/noise_indicator.lua | 3 ++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/desert_temple.lua b/mods/MAPGEN/mcl_structures/desert_temple.lua index 682af9d4d..e4d4c10dc 100644 --- a/mods/MAPGEN/mcl_structures/desert_temple.lua +++ b/mods/MAPGEN/mcl_structures/desert_temple.lua @@ -121,8 +121,7 @@ mcl_structures.register_structure({ deco_type = "simple", place_on = node_list, flags = "all_floors", - --fill_ratio = 0.00003, - fill_ratio = 0.003, + fill_ratio = 0.00003, y_min = 3, y_max = mcl_mapgen.overworld.max, height = 1, @@ -149,6 +148,9 @@ mcl_structures.register_structure({ local b = (math.floor(seed / 39) + 4) % 12 minetest.chat_send_all("seed=" .. tostring(seed) .. ", a=" .. tostring(a) .. ", b=" ..tostring(b)) if a ~= b then return end + mcl_structures.perlin_noise = mcl_structures.perlin_noise or minetest.get_perlin(329, 3, 0.6, 100) + local current_noise_level = mcl_structures.perlin_noise:get_3d(minp) + if current_noise_level > -0.3 then return end local pos = pos_list[1] if #pos_list > 1 then local count = get_place_rank(pos) diff --git a/mods/MAPGEN/mcl_structures/jungle_temple.lua b/mods/MAPGEN/mcl_structures/jungle_temple.lua index 2fe1fdd2b..210889e02 100644 --- a/mods/MAPGEN/mcl_structures/jungle_temple.lua +++ b/mods/MAPGEN/mcl_structures/jungle_temple.lua @@ -135,9 +135,8 @@ mcl_structures.register_structure({ deco_type = "simple", place_on = node_list, flags = "all_floors", - --fill_ratio = 0.00003, - fill_ratio = 0.003, - y_min = 3, + fill_ratio = 0.0003, + y_min = -13, y_max = mcl_mapgen.overworld.max, height = 1, biomes = @@ -157,10 +156,13 @@ mcl_structures.register_structure({ }, }, on_finished_chunk = function(minp, maxp, seed, vm_context, pos_list) --- local a = seed % 14 --- local b = (math.floor(seed / 39) + 4) % 12 --- minetest.chat_send_all("seed=" .. tostring(seed) .. ", a=" .. tostring(a) .. ", b=" ..tostring(b)) --- if a ~= b then return end + local a = seed % 17 + local b = (math.ceil(seed / 123) - 4) % 17 + minetest.chat_send_all("seed=" .. tostring(seed) .. ", a=" .. tostring(a) .. ", b=" ..tostring(b)) + if a ~= b then return end + mcl_structures.perlin_noise = mcl_structures.perlin_noise or minetest.get_perlin(329, 3, 0.6, 100) + local current_noise_level = mcl_structures.perlin_noise:get_3d(maxp) + if current_noise_level < 0.8 then return end local pos local count = -1 for i = 1, #pos_list do diff --git a/mods/MAPGEN/mcl_structures/noise_indicator.lua b/mods/MAPGEN/mcl_structures/noise_indicator.lua index 3f45040c0..19007ed16 100644 --- a/mods/MAPGEN/mcl_structures/noise_indicator.lua +++ b/mods/MAPGEN/mcl_structures/noise_indicator.lua @@ -26,9 +26,10 @@ local math_floor, math_ceil = math.floor, math.ceil mcl_mapgen.register_mapgen(function(minp, maxp, seed, vm_context) mcl_structures.perlin_noise = mcl_structures.perlin_noise or minetest.get_perlin(329, 3, 0.6, 100) local perlin_noise = mcl_structures.perlin_noise + local y0 = minp.y for x0 = minp.x, maxp.x do for z0 = minp.z, maxp.z do - local current_noise_level = perlin_noise:get_2d({x=x0, y=z0}) + local current_noise_level = perlin_noise:get_3d({x=x0, y=y0, z=z0}) local amount if current_noise_level < 0 then amount = math_max(math_ceil(current_noise_level * 9), -9)