Clean up several functions.

This commit is contained in:
Duane 2016-06-23 07:23:03 -05:00
parent e6f482c9d5
commit 42916c4666
5 changed files with 159 additions and 103 deletions

View file

@ -99,18 +99,17 @@ fun_caves.place_schematic = function(minp, maxp, data, p2data, area, node, pos,
if pos.x + x > minp.x and pos.x + x < maxp.x and pos.z + z > minp.z and pos.z + z < maxp.z then
local ivm = area:index(pos.x + x, pos.y, pos.z + z)
local isch = z1 * schem.size.y * schem.size.x + x1 + 1
local math_random = math.random
for y = 0, schem.size.y - 1 do
local dy = pos.y - minp.y + y
--if math.min(dx, csize.x - dx) + math.min(dy, csize.y - dy) + math.min(dz, csize.z - dz) > bevel then
if yslice[y] or 255 >= math.random(255) then
if yslice[y] or 255 >= math_random(255) then
local prob = schem.data[isch].prob or schem.data[isch].param1 or 255
if prob >= math.random(255) and schem.data[isch].name ~= "air" then
if prob >= math_random(255) and schem.data[isch].name ~= "air" then
data[ivm] = node[schem.data[isch].name]
end
local param2 = schem.data[isch].param2 or 0
p2data[ivm] = param2
end
--end
ivm = ivm + area.ystride
isch = isch + schem.size.x