Localize variables. Prevent shafts from damaging trees.

This commit is contained in:
Duane 2016-08-02 04:56:42 -05:00
parent 61c3cb0edd
commit 2270e87a71
2 changed files with 11 additions and 9 deletions

View file

@ -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