Use blockseed again for the randomizer...
parent
8f3414495f
commit
4f57871cb9
25
init.lua
25
init.lua
|
@ -106,19 +106,16 @@ local chaos_mode = minetest.settings:get_bool("tsm_railcorridors_chaos") or fals
|
||||||
|
|
||||||
-- Random Perlin noise generators
|
-- Random Perlin noise generators
|
||||||
local pr, pr_carts, webperlin_major, webperlin_minor
|
local pr, pr_carts, webperlin_major, webperlin_minor
|
||||||
local pr_inited = false
|
|
||||||
|
|
||||||
local function InitRandomizer()
|
local function InitRandomizer(seed)
|
||||||
if not pr_inited then
|
-- Mostly used for corridor gen.
|
||||||
local seed = minetest.get_mapgen_setting("seed")
|
pr = PseudoRandom(seed)
|
||||||
-- Mostly used for corridor gen.
|
-- Separate randomizer for carts because spawning carts is very timing-dependent
|
||||||
pr = PseudoRandom(seed)
|
pr_carts = PseudoRandom(seed-654)
|
||||||
pr_carts = PseudoRandom(seed-654)
|
-- Used for cobweb generation, both noises have to reach a high value for cobwebs to appear
|
||||||
-- Used for cobweb generation, both noises have to reach a high value for cobwebs to appear
|
webperlin_major = PerlinNoise(934, 3, 0.6, 500)
|
||||||
webperlin_major = PerlinNoise(934, 3, 0.6, 500)
|
webperlin_minor = PerlinNoise(834, 3, 0.6, 50)
|
||||||
webperlin_minor = PerlinNoise(834, 3, 0.6, 50)
|
pr_inited = true
|
||||||
pr_inited = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -967,7 +964,9 @@ end
|
||||||
|
|
||||||
-- The rail corridor algorithm starts here
|
-- The rail corridor algorithm starts here
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
InitRandomizer()
|
-- We re-init the randomizer for every mapblock as we start generating in the middle of each mapblock.
|
||||||
|
-- We can't use the mapgen seed as this would make the algorithm depending on the order the mapblocks generate.
|
||||||
|
InitRandomizer(blockseed)
|
||||||
if minp.y < height_max and maxp.y > height_min and pr:next() < probability_railcaves_in_chunk then
|
if minp.y < height_max and maxp.y > height_min and pr:next() < probability_railcaves_in_chunk then
|
||||||
-- Get semi-random height in chunk
|
-- Get semi-random height in chunk
|
||||||
local buffer = 5
|
local buffer = 5
|
||||||
|
|
Loading…
Reference in New Issue