forked from mtcontrib/minetest-mod-snow
Add inkelyad's smooth transitions, add config option for this.
This commit is contained in:
parent
04505c42ae
commit
2aac1b5175
@ -5,3 +5,6 @@ snow.enable_snowfall = false
|
||||
|
||||
--Enables debuging.
|
||||
snow.debug = false
|
||||
|
||||
--Enables smooth transition of biomes.
|
||||
snow.smooth = false
|
||||
|
10
mapgen.lua
10
mapgen.lua
@ -114,6 +114,7 @@ if maxp.y >= -10 then
|
||||
end
|
||||
|
||||
local make_pine = snow.make_pine
|
||||
local smooth = snow.smooth
|
||||
|
||||
--Reseed random.
|
||||
pr = PseudoRandom(seed+68)
|
||||
@ -133,8 +134,15 @@ if maxp.y >= -10 then
|
||||
local z = z0+j
|
||||
|
||||
--Check if we are in a "Snow biome"
|
||||
local in_biome = false
|
||||
local test = perlin1:get2d({x=x, y=z})
|
||||
if test > 0.53 then
|
||||
if smooth and (test > 0.73 or (test > 0.43 and pr:next(0,29) > (0.73 - test) * 100 )) then
|
||||
in_biome = true
|
||||
elseif not smooth and test > 0.53 then
|
||||
in_biome = true
|
||||
end
|
||||
|
||||
if in_biome then
|
||||
|
||||
-- Find ground level (0...15)
|
||||
local ground_y = nil
|
||||
|
Loading…
Reference in New Issue
Block a user