Compare commits
5 Commits
2a271d5075
...
677c9c134d
Author | SHA1 | Date |
---|---|---|
Lemon Slemon | 677c9c134d | |
Lemon Slemon | d59b04c11c | |
Lemon Slemon | 3964b4c687 | |
Lemon Slemon | 159e337afa | |
Lemon Slemon | 49cb7cdda8 |
|
@ -1 +1,2 @@
|
|||
default
|
||||
flowers
|
||||
|
|
44
init.lua
44
init.lua
|
@ -6,24 +6,21 @@ if not chunksize then
|
|||
end
|
||||
|
||||
if not SIZE then
|
||||
SIZE = 100
|
||||
SIZE = -100
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- Safe size (positive and absolute)
|
||||
local ssize = math.ceil(math.abs(SIZE))
|
||||
|
||||
-- Heights
|
||||
local h = {}
|
||||
h.sea = -1
|
||||
h.beach = 0
|
||||
h.sea = 0
|
||||
h.ice = ssize * (3/4)
|
||||
|
||||
local recursion_depth = math.ceil(math.abs(SIZE)/5)
|
||||
local recursion_depth = math.ceil(math.abs(SIZE)/10)
|
||||
|
||||
local function do_ws_func(depth, a, x)
|
||||
local n = x/(4*SIZE)
|
||||
local n = x/(16*SIZE)
|
||||
local y = 0
|
||||
for k=1,depth do
|
||||
y = y + SIZE*(math.sin(math.pi * k^a * n)/(math.pi * k^a))
|
||||
|
@ -47,6 +44,15 @@ local function get_ws_list(a,x)
|
|||
return v
|
||||
end
|
||||
|
||||
local function get_distance(x,z,x0,z0)
|
||||
if not (x0 or z0) then
|
||||
x0 = 0
|
||||
z0 = 0
|
||||
end
|
||||
y = (((x - x0)/(SIZE))^2 + ((z - z0)/(SIZE))^2)^(1/2)
|
||||
return y
|
||||
end
|
||||
|
||||
local c_water = minetest.get_content_id("default:water_source")
|
||||
local c_stone = minetest.get_content_id("default:stone")
|
||||
local c_dirt = minetest.get_content_id("default:dirt")
|
||||
|
@ -76,24 +82,32 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
local land_base = heightx[x]
|
||||
for z=minp.z,maxp.z do
|
||||
local land_base = land_base + heightz[z]
|
||||
land_base = land_base + SIZE/3*math.sin(((x/(SIZE))^2 + (z/(SIZE))^2)^(1/2))
|
||||
land_base = land_base + SIZE/3*math.sin(get_distance(x,z))
|
||||
if SIZE*math.cos(get_distance(x/SIZE,z,100,-1000)) - land_base > SIZE then
|
||||
land_base = land_base + SIZE/5*math.sin(get_distance(x,z,12*z,-51*x)/SIZE)
|
||||
end
|
||||
land_base = math.floor(land_base)
|
||||
local beach = math.floor(SIZE/97*math.cos((x - z)*10/(SIZE))) -- Also used for ice
|
||||
for y=minp.y,maxp.y do
|
||||
local p_pos = area:index(x, y, z)
|
||||
if y < land_base - 1 then
|
||||
data[p_pos] = c_stone
|
||||
elseif y == math.floor(land_base) then
|
||||
if y > h.ice then
|
||||
elseif y == land_base then
|
||||
if y > beach + h.ice then
|
||||
data[p_pos] = c_snow
|
||||
elseif y > h.beach then
|
||||
data[p_pos] = c_dirt_with_grass
|
||||
elseif y >= beach + h.sea then
|
||||
if y >= h.sea - 1 then
|
||||
data[p_pos] = c_dirt_with_grass
|
||||
else
|
||||
data[p_pos] = c_dirt
|
||||
end
|
||||
else
|
||||
data[p_pos] = c_sand
|
||||
end
|
||||
elseif y == math.floor(land_base) - 1 then
|
||||
if y > h.ice then
|
||||
elseif y == land_base - 1 then
|
||||
if y > beach + h.ice then
|
||||
data[p_pos] = c_ice
|
||||
elseif y > h.beach then
|
||||
elseif y >= beach + h.sea then
|
||||
data[p_pos] = c_dirt
|
||||
else
|
||||
data[p_pos] = c_sandstone
|
||||
|
|
Loading…
Reference in New Issue