Add more complex temple spawn conditions

This commit is contained in:
kay27 2022-01-17 06:17:52 +04:00
parent d3265a2f72
commit 8caf8c91dd
3 changed files with 15 additions and 10 deletions

View File

@ -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)

View File

@ -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

View File

@ -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)