Fix ocean monument chance

This commit is contained in:
kay27 2022-02-17 02:54:16 +04:00
parent 86dc2e0495
commit 0b17a79008
1 changed files with 10 additions and 5 deletions

View File

@ -1,7 +1,8 @@
local chance_per_chunk = 5
-- Check it: local noise_multiplier = 1
-- seed 1, v7 mapgen local random_offset = 12342
-- /teleport 14958,8,11370 local struct_threshold = chance_per_chunk
local mcl_structures_get_perlin_noise_level = mcl_structures.get_perlin_noise_level
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
@ -44,8 +45,12 @@ mcl_mapgen.register_mapgen(function(minp, maxp, seed)
local y = minp.y local y = minp.y
if y ~= y_wanted then return end if y ~= y_wanted then return end
local pr = PseudoRandom(seed + random_offset)
local random_number = pr:next(1, chance_per_chunk)
local noise = mcl_structures_get_perlin_noise_level(minp) * noise_multiplier
if not noise or (random_number + noise) < struct_threshold then return end
local x, z = minp.x, minp.z local x, z = minp.x, minp.z
local pr = PseudoRandom(seed)
-- scan the ocean - it should be the ocean: -- scan the ocean - it should be the ocean:
for i = 1, pr:next(10, 100) do for i = 1, pr:next(10, 100) do