Localize variables. Prevent shafts from damaging trees.
This commit is contained in:
parent
61c3cb0edd
commit
2270e87a71
2 changed files with 11 additions and 9 deletions
10
dungeon.lua
10
dungeon.lua
|
@ -186,10 +186,10 @@ fun_caves.dungeon = function(minp_in, maxp_in, data, p2data, area, node, heightm
|
|||
else
|
||||
t = 44 - z
|
||||
end
|
||||
t = math.floor(t / 44 * 22)
|
||||
t = math.floor(t / 44 * 10)
|
||||
|
||||
if x < 2 or x > 9 or z < 2 or z > 9 then
|
||||
if math.floor((y - minp.y) % 22) == t then
|
||||
if math.floor((y - minp.y) % 10) == t then
|
||||
data[ivm] = node['default:cobble']
|
||||
else
|
||||
data[ivm] = node['air']
|
||||
|
@ -210,10 +210,10 @@ fun_caves.dungeon = function(minp_in, maxp_in, data, p2data, area, node, heightm
|
|||
return
|
||||
end
|
||||
|
||||
minp = table.copy(minp_in)
|
||||
local minp = table.copy(minp_in)
|
||||
minp.x = minp.x + 10
|
||||
minp.z = minp.z + 10
|
||||
maxp = table.copy(maxp_in)
|
||||
local maxp = table.copy(maxp_in)
|
||||
maxp.x = maxp.x - 9
|
||||
maxp.z = maxp.z - 9
|
||||
local level = math.min(6, math.ceil(maxp.y / math.floor(max_depth / -6)))
|
||||
|
@ -381,5 +381,5 @@ fun_caves.dungeon = function(minp_in, maxp_in, data, p2data, area, node, heightm
|
|||
end
|
||||
end
|
||||
|
||||
return true, true
|
||||
return true, true, true
|
||||
end
|
||||
|
|
10
mapgen.lua
10
mapgen.lua
|
@ -430,18 +430,20 @@ local function generate(p_minp, p_maxp, seed)
|
|||
end
|
||||
|
||||
if fun_caves.dungeon then
|
||||
write, write_p2 = fun_caves.dungeon(minp, maxp, data, p2data, area, node, heightmap)
|
||||
if write then
|
||||
local full
|
||||
write, write_p2, full = fun_caves.dungeon(minp, maxp, data, p2data, area, node, heightmap)
|
||||
if write and full 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)
|
||||
local h2, write_cave
|
||||
write_cave, h2 = fun_caves.cavegen(minp, maxp, data, area, node, heightmap, underzone, ground_nodes)
|
||||
if h2 then
|
||||
heightmap = h2
|
||||
end
|
||||
write = write or write_cave
|
||||
|
||||
local biomemap
|
||||
if fun_caves.use_bi_hi then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue