Most dungeon features working.

This commit is contained in:
Duane 2016-08-02 04:18:20 -05:00
parent 5abe211fb6
commit 61c3cb0edd
7 changed files with 570 additions and 710 deletions

View file

@ -1,6 +1,5 @@
local max_depth = 31000
local seed_noise = {offset = 0, scale = 32768, seed = 5202, spread = {x = 80, y = 80, z = 80}, octaves = 2, persist = 0.4, lacunarity = 2}
local fortress_noise = {offset = 0, scale = 1, seed = -4082, spread = {x = 7, y = 7, z = 7}, octaves = 4, persist = 1, lacunarity = 2}
-- This tables looks up nodes that aren't already stored.
@ -409,40 +408,76 @@ local function generate(p_minp, p_maxp, seed)
end
local aster = false
if minp.y > 17200 then
-- nop
elseif minp.y > 11000 and fun_caves.asteroids then
write = fun_caves.asteroids(minp, maxp, data, p2data, area, node)
aster = true
elseif minp.y > 8400 and fun_caves.skysea then
write = fun_caves.skysea(minp, maxp, data, p2data, area, node)
elseif minp.y > 4000 and fun_caves.cloudgen then
write = fun_caves.cloudgen(minp, maxp, data, p2data, area, node)
elseif not underzone and fun_caves.is_fortress(minp, csize) and fun_caves.fortress then
fun_caves.fortress(minp, maxp, data, area, node)
write = true
elseif fun_caves.cavegen and fun_caves.decogen and fun_caves.treegen then
local write_cave, write_deco, write_tree, write_pyr, write_vill, h2
write_cave, h2 = fun_caves.cavegen(minp, maxp, data, area, node, heightmap, underzone, ground_nodes)
if h2 then
heightmap = h2
for fake_loop = 1, 1 do
if minp.y > 17200 then
break
end
local biomemap
if fun_caves.use_bi_hi then
biomemap = minetest.get_mapgen_object("biomemap")
if minp.y > 11000 and fun_caves.asteroids then
write = fun_caves.asteroids(minp, maxp, data, p2data, area, node)
aster = true
break
end
write_deco, write_p2 = fun_caves.decogen(minp, maxp, data, p2data, area, node, heightmap, biomemap, biome_ids, underzone)
write_tree = fun_caves.treegen(minp, maxp, data, p2data, area, node)
if not write_tree and fun_caves.pyramid then
write_pyr, write_p4 = fun_caves.pyramid(minp, maxp, data, p2data, area, biomemap, biome_ids, node, heightmap)
if minp.y > 8400 and fun_caves.skysea then
write = fun_caves.skysea(minp, maxp, data, p2data, area, node)
break
end
if fun_caves.use_villages and biomemap and not (write_tree or write_pyr) and fun_caves.village then
local biome = biome_ids[biomemap[40*80+40]]
write_vill = fun_caves.village(minp, maxp, data, p2data, area, node, biome, heightmap)
if minp.y > 4000 and fun_caves.cloudgen then
write = fun_caves.cloudgen(minp, maxp, data, p2data, area, node)
break
end
if fun_caves.dungeon then
write, write_p2 = fun_caves.dungeon(minp, maxp, data, p2data, area, node, heightmap)
if write then
break
end
end
if fun_caves.cavegen and fun_caves.decogen then
local h2
write, h2 = fun_caves.cavegen(minp, maxp, data, area, node, heightmap, underzone, ground_nodes)
if h2 then
heightmap = h2
end
local biomemap
if fun_caves.use_bi_hi then
biomemap = minetest.get_mapgen_object("biomemap")
end
local write_deco
write_deco, write_p2 = fun_caves.decogen(minp, maxp, data, p2data, area, node, heightmap, biomemap, biome_ids, underzone)
write = write or write_deco
if fun_caves.treegen then
local write_tree = fun_caves.treegen(minp, maxp, data, p2data, area, node)
if write_tree then
write = true
break
end
end
if fun_caves.pyramid then
local write_pyr, write_p4 = fun_caves.pyramid(minp, maxp, data, p2data, area, biomemap, biome_ids, node, heightmap)
if write_pyr then
write = true
write_p2 = write_p2 or write_p4
break
end
end
if fun_caves.use_villages and biomemap and fun_caves.village then
local biome = biome_ids[biomemap[40*80+40]]
local write_vill = fun_caves.village(minp, maxp, data, p2data, area, node, biome, heightmap)
if write_vill then
write = true
break
end
end
end
write = write_cave or write_deco or write_tree or write_pyr or write_vill
end
@ -452,7 +487,7 @@ local function generate(p_minp, p_maxp, seed)
vm:set_param2_data(p2data)
end
if true or fun_caves.DEBUG then
if fun_caves.DEBUG then
vm:set_lighting({day = 15, night = 15})
else
-- set_lighting causes lighting artifacts,
@ -473,7 +508,7 @@ if fun_caves.path then
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 .. "/dungeon.lua")
dofile(fun_caves.path .. "/pyramid.lua")
dofile(fun_caves.path .. "/treegen.lua")
dofile(fun_caves.path .. "/village.lua")
@ -482,7 +517,9 @@ end
local function pgenerate(...)
local status, err = pcall(generate, ...)
--local status, err = pcall(generate, ...)
local status, err = true
generate(...)
if not status then
print('Fun Caves: Could not generate terrain:')
print(dump(err))