Add sky-sea.

This commit is contained in:
Duane 2016-06-12 19:53:23 -05:00
parent 7ec0eae568
commit 37a5474570
5 changed files with 114 additions and 5 deletions

View file

@ -15,8 +15,7 @@ local plant_noise = {offset = 0.0, scale = 1.0, spread = {x = 200, y = 200, z =
local biome_noise = {offset = 0.0, scale = 1.0, spread = {x = 400, y = 400, z = 400}, seed = -1471, octaves = 3, persist = 0.5, lacunarity = 2.0}
fun_caves.cloudgen = function(minp, maxp, data, p2data, area, node)
local clouds = ceil(minp.y / floor(max_depth / 7))
if abs(clouds * floor(max_depth / 7) - minp.y) > 80 then
if minp.y ~= 4368 then
return
end

View file

@ -374,7 +374,11 @@ local function generate(p_minp, p_maxp, seed)
end
end
if minp.y > 3000 then
if minp.y > 12800 then
-- nop
elseif minp.y > 8400 then
write = fun_caves.skysea(minp, maxp, data, p2data, area, node)
elseif minp.y > 4000 then
write = fun_caves.cloudgen(minp, maxp, data, p2data, area, node)
elseif not underzone and fun_caves.is_fortress(minp, csize) then
--if not underzone then
@ -419,6 +423,7 @@ dofile(fun_caves.path .. "/cavegen.lua")
dofile(fun_caves.path .. "/cloudgen.lua")
dofile(fun_caves.path .. "/decogen.lua")
dofile(fun_caves.path .. "/fortress.lua")
dofile(fun_caves.path .. "/skyseagen.lua")
-- Inserting helps to ensure that fun_caves operates first.

View file

@ -110,8 +110,9 @@ end
if minetest.registered_entities["mobs_fish:clownfish"] then
--local l_spawn_near = {"default:sand","default:dirt","group:seaplants","group:seacoral"}
mobs:spawn_specific("mobs_fish:clownfish", {"default:water_source", "default:water_flowing"}, {"default:sand","default:dirt", "fun_caves:cloud", "fun_caves:storm_cloud","group:seaplants","group:seacoral"}, 5, 20, 30, 10000, 1, 4000, 31000)
mobs:spawn_specific("mobs_fish:tropical", {"default:water_source", "default:water_flowing"}, {"default:sand","default:dirt", "fun_caves:cloud", "fun_caves:storm_cloud","group:seaplants","group:seacoral"}, 5, 20, 30, 10000, 1, 4000, 31000)
mobs:spawn_specific("mobs_fish:clownfish", {"default:water_source", "default:water_flowing"}, {"default:sand","default:dirt", "fun_caves:cloud", "fun_caves:storm_cloud","group:seaplants","group:seacoral"}, 5, 20, 30, 10000, 1, 4000, 5000)
mobs:spawn_specific("mobs_fish:tropical", {"default:water_source", "default:water_flowing"}, {"default:sand","default:dirt", "fun_caves:cloud", "fun_caves:storm_cloud","group:seaplants","group:seacoral"}, 5, 20, 30, 10000, 1, 4000, 5000)
mobs:spawn_specific("mobs_fish:tropical", {"default:water_source", "default:water_flowing"}, nil, 5, 20, 30, 10000, 1, 8769, 8798)
end
if minetest.registered_entities["mobs_monster:spider"] then
@ -313,6 +314,10 @@ if minetest.registered_entities["mobs_creeper:creeper"] then
end
if minetest.registered_entities["mobs_sharks:shark_lg"] then
mobs:spawn_specific("mobs_sharks:shark_sm", {"default:water_source"}, nil, 5, 20, 30, 60000, 1, 8769, 8798)
mobs:spawn_specific("mobs_sharks:shark_md", {"default:water_source"}, nil, 5, 20, 30, 60000, 1, 8769, 8798)
mobs:spawn_specific("mobs_sharks:shark_lg", {"default:water_source"}, nil, 5, 20, 30, 60000, 1, 8769, 8798)
local m = table.copy(minetest.registered_entities["mobs_sharks:shark_lg"])
local l_spawn_in = {"default:water_flowing","default:water_source"}
local l_spawn_near = {"default:water_flowing","default:water_source","seawrecks:woodship","seawrecks:uboot"}

100
skyseagen.lua Normal file
View file

@ -0,0 +1,100 @@
local rand = math.random
local min = math.min
local floor = math.floor
local ceil = math.ceil
local abs = math.abs
local max_depth = 31000
local newnode = fun_caves.clone_node("default:dirt")
newnode.description = "Air"
newnode.tiles = {'fun_caves_blank.png'}
newnode.sunlight_propagates = true
newnode.use_texture_alpha = true
newnode.light_source = 14
newnode.walkable = false
newnode.buildable_to = true
newnode.pointable = false
minetest.register_node("fun_caves:airy", newnode)
local terrain_noise_1 = {offset = 10, scale = 10, seed = 4877, spread = {x = 120, y = 120, z = 120}, octaves = 3, persist = 1, lacunarity = 2}
local plant_noise = {offset = 0.0, scale = 1.0, spread = {x = 200, y = 200, z = 200}, seed = -2525, octaves = 3, persist = 0.7, lacunarity = 2.0}
local biome_noise = {offset = 0.0, scale = 1.0, spread = {x = 400, y = 400, z = 400}, seed = -1471, octaves = 3, persist = 0.5, lacunarity = 2.0}
fun_caves.skysea = function(minp, maxp, data, p2data, area, node)
if minp.y ~= 8768 then
return
end
local csize = vector.add(vector.subtract(maxp, minp), 1)
local map_max = {x = csize.x, y = csize.y, z = csize.z}
local map_min = {x = minp.x, y = minp.y, z = minp.z}
local terrain_1 = minetest.get_perlin_map(terrain_noise_1, {x=csize.x, y=csize.z}):get2dMap_flat({x=minp.x, y=minp.z})
local plant_n = minetest.get_perlin_map(plant_noise, {x=csize.x, y=csize.z}):get2dMap_flat({x=minp.x, y=minp.z})
local biome_n = minetest.get_perlin_map(biome_noise, {x=csize.x, y=csize.z}):get2dMap_flat({x=minp.x, y=minp.z})
local write = false
local index = 0
local index3d = 0
for z = minp.z, maxp.z do
for x = minp.x, maxp.x do
index = index + 1
index3d = (z - minp.z) * (csize.y) * csize.x + (x - minp.x) + 1
local ivm = area:index(x, minp.y, z)
terrain_1[index] = floor(terrain_1[index] + 0.5)
for y = minp.y, maxp.y do
local dy = y - minp.y
if dy == 0 then
data[ivm] = node['fun_caves:airy']
write = true
elseif dy == 32 and terrain_1[index] > 9 then
data[ivm] = node['default:wood']
write = true
elseif dy < 33 then
data[ivm] = node['default:water_source']
write = true
elseif dy == 33 and terrain_1[index] > 10 then
data[ivm] = node['default:wood']
write = true
elseif dy > 33 and dy == terrain_1[index] + 22 then
data[ivm] = node['default:dirt_with_grass']
write = true
elseif dy > 33 and dy < terrain_1[index] + 22 then
data[ivm] = node['default:dirt']
write = true
end
ivm = ivm + area.ystride
index3d = index3d + csize.x
end
end
end
local index = 0
local index3d = 0
for z = minp.z, maxp.z do
for x = minp.x, maxp.x do
index = index + 1
local ivm = area:index(x, minp.y, z)
local cloud
--if biome_n[index] < 0 then
terrain_1[index] = floor(terrain_1[index] + 0.5)
if terrain_1[index] > 0 then
for y = minp.y, maxp.y do
local dy = y - minp.y
if data[ivm] == node['air'] and data[ivm - area.ystride] == node['default:dirt_with_grass'] then
end
ivm = ivm + area.ystride
end
end
end
end
return write
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B