Extra error checking: global variables
This commit is contained in:
parent
bf26b8bee1
commit
1648bc459f
17 changed files with 362 additions and 323 deletions
38
mapgen.lua
38
mapgen.lua
|
@ -399,6 +399,10 @@ local function generate(p_minp, p_maxp, seed)
|
|||
local write = false
|
||||
local write_p2, write_p4 = false, false
|
||||
local underzone
|
||||
if not fun_caves.underzones then
|
||||
return
|
||||
end
|
||||
|
||||
for _, uz in pairs(fun_caves.underzones) do
|
||||
local avg = (minp.y + maxp.y) / 2
|
||||
if avg <= uz.upper_bound and avg >= uz.lower_bound then
|
||||
|
@ -409,18 +413,18 @@ local function generate(p_minp, p_maxp, seed)
|
|||
local aster = false
|
||||
if minp.y > 17200 then
|
||||
-- nop
|
||||
elseif minp.y > 11000 then
|
||||
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 then
|
||||
elseif minp.y > 8400 and fun_caves.skysea then
|
||||
write = fun_caves.skysea(minp, maxp, data, p2data, area, node)
|
||||
elseif minp.y > 4000 then
|
||||
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) then
|
||||
elseif not underzone and fun_caves.is_fortress(minp, csize) and fun_caves.fortress then
|
||||
--if not underzone then
|
||||
fun_caves.fortress(minp, maxp, data, area, node)
|
||||
write = true
|
||||
else
|
||||
elseif fun_caves.cavegen and fun_caves.decogen and fun_caves.treegen then
|
||||
local write1, write2, write3, write4, write5, h2
|
||||
write1, h2 = fun_caves.cavegen(minp, maxp, data, area, node, heightmap, underzone)
|
||||
if h2 then
|
||||
|
@ -434,10 +438,10 @@ local function generate(p_minp, p_maxp, seed)
|
|||
|
||||
write2, write_p2 = fun_caves.decogen(minp, maxp, data, p2data, area, node, heightmap, biomemap, biome_ids, underzone)
|
||||
write3 = fun_caves.treegen(minp, maxp, data, p2data, area, node)
|
||||
if not write3 then
|
||||
if not write3 and fun_caves.pyramid then
|
||||
write4, write_p4 = fun_caves.pyramid(minp, maxp, data, p2data, area, biomemap, biome_ids, node, heightmap)
|
||||
end
|
||||
if fun_caves.use_villages and biomemap and not (write3 or write4) then
|
||||
if fun_caves.use_villages and biomemap and not (write3 or write4) and fun_caves.village then
|
||||
local biome = biome_ids[biomemap[40*80+40]]
|
||||
write5 = fun_caves.village(minp, maxp, data, p2data, area, node, biome, heightmap)
|
||||
end
|
||||
|
@ -475,15 +479,17 @@ local function generate(p_minp, p_maxp, seed)
|
|||
end
|
||||
|
||||
|
||||
dofile(fun_caves.path .. "/asteroids.lua")
|
||||
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 .. "/pyramid.lua")
|
||||
dofile(fun_caves.path .. "/treegen.lua")
|
||||
dofile(fun_caves.path .. "/village.lua")
|
||||
dofile(fun_caves.path .. "/skyseagen.lua")
|
||||
if fun_caves.path then
|
||||
dofile(fun_caves.path .. "/asteroids.lua")
|
||||
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 .. "/pyramid.lua")
|
||||
dofile(fun_caves.path .. "/treegen.lua")
|
||||
dofile(fun_caves.path .. "/village.lua")
|
||||
dofile(fun_caves.path .. "/skyseagen.lua")
|
||||
end
|
||||
|
||||
|
||||
-- Inserting helps to ensure that fun_caves operates first.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue