Added grass and variable coast line.
This commit is contained in:
parent
159e337afa
commit
3964b4c687
@ -1 +1,2 @@
|
|||||||
default
|
default
|
||||||
|
flowers
|
||||||
|
34
init.lua
34
init.lua
@ -6,7 +6,7 @@ if not chunksize then
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not SIZE then
|
if not SIZE then
|
||||||
SIZE = 350
|
SIZE = 1000
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,6 @@ local ssize = math.ceil(math.abs(SIZE))
|
|||||||
-- Heights
|
-- Heights
|
||||||
local h = {}
|
local h = {}
|
||||||
h.sea = -1
|
h.sea = -1
|
||||||
h.beach = 0
|
|
||||||
h.ice = ssize * (3/4)
|
h.ice = ssize * (3/4)
|
||||||
|
|
||||||
local recursion_depth = math.ceil(math.abs(SIZE)/10)
|
local recursion_depth = math.ceil(math.abs(SIZE)/10)
|
||||||
@ -64,7 +63,7 @@ local c_sand = minetest.get_content_id("default:sand")
|
|||||||
local c_sandstone = minetest.get_content_id("default:sandstone")
|
local c_sandstone = minetest.get_content_id("default:sandstone")
|
||||||
local c_snow = minetest.get_content_id("default:snowblock")
|
local c_snow = minetest.get_content_id("default:snowblock")
|
||||||
local c_ice = minetest.get_content_id("default:ice")
|
local c_ice = minetest.get_content_id("default:ice")
|
||||||
local c_lava = minetest.get_content_id("default:lava_source")
|
local c_grass = minetest.get_content_id("default:grass_1")
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
|
|
||||||
@ -87,28 +86,33 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
for z=minp.z,maxp.z do
|
for z=minp.z,maxp.z do
|
||||||
local land_base = land_base + heightz[z]
|
local land_base = land_base + heightz[z]
|
||||||
land_base = land_base + SIZE/3*math.sin(get_distance(x,z))
|
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
|
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,1230,-51234)/SIZE) + SIZE/5*math.sin((x + y)/SIZE)
|
land_base = land_base + SIZE/5*math.sin(get_distance(x,z,12*z,-51*x)/SIZE)
|
||||||
end
|
end
|
||||||
|
|
||||||
land_base = math.floor(land_base)
|
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
|
for y=minp.y,maxp.y do
|
||||||
local p_pos = area:index(x, y, z)
|
local p_pos = area:index(x, y, z)
|
||||||
if y < land_base - 1 then
|
if y < land_base - 1 then
|
||||||
data[p_pos] = c_stone
|
data[p_pos] = c_stone
|
||||||
elseif y == math.floor(land_base) then
|
elseif y == land_base + 1 and y > beach + 1 and y < beach + h.ice and y > h.sea then
|
||||||
if y > h.ice then
|
data[p_pos] = c_grass
|
||||||
|
elseif y == land_base then
|
||||||
|
if y > beach + h.ice then
|
||||||
data[p_pos] = c_snow
|
data[p_pos] = c_snow
|
||||||
elseif y > h.beach then
|
elseif y >= beach then
|
||||||
data[p_pos] = c_dirt_with_grass
|
if y >= h.sea - 1 then
|
||||||
|
data[p_pos] = c_dirt_with_grass
|
||||||
|
else
|
||||||
|
data[p_pos] = c_dirt
|
||||||
|
end
|
||||||
else
|
else
|
||||||
data[p_pos] = c_sand
|
data[p_pos] = c_sand
|
||||||
end
|
end
|
||||||
elseif y == math.floor(land_base) - 1 then
|
elseif y == land_base - 1 then
|
||||||
if y > h.ice then
|
if y > beach + h.ice then
|
||||||
data[p_pos] = c_ice
|
data[p_pos] = c_ice
|
||||||
elseif y > h.beach then
|
elseif y >= beach then
|
||||||
data[p_pos] = c_dirt
|
data[p_pos] = c_dirt
|
||||||
else
|
else
|
||||||
data[p_pos] = c_sandstone
|
data[p_pos] = c_sandstone
|
||||||
@ -121,8 +125,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
vm:set_data(data)
|
vm:set_data(data)
|
||||||
vm:calc_lighting()
|
-- vm:calc_lighting()
|
||||||
vm:update_liquids()
|
-- vm:update_liquids()
|
||||||
vm:write_to_map()
|
vm:write_to_map()
|
||||||
|
|
||||||
local geninfo = string.format("[mg] done after: %.2fs", os.clock() - t1)
|
local geninfo = string.format("[mg] done after: %.2fs", os.clock() - t1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user