Better protection for the point distribution

There is now an enforced minimum of 1 - this is required for the noise to
be accurate in any case, so there is no issue
Can easily be removed for use of code in other areas
This commit is contained in:
qwertymine3 2015-11-10 20:16:49 +00:00
parent caf4282689
commit 32d31426c9

View File

@ -392,12 +392,21 @@ local generate_points = function(sector,seed,layer)
local seen = {}
local num = prand:next(dist.random_min,dist.random_max)
--This is the new distribution method - very manual, but is flexible
local set = false
for i=#dist,1,-1 do
if num <= dist[i] then
num = i
set = true
break
end
end
if not set then
num = 1
end
while num > 0 do
--The points are aligned to 0.1 of a block
--This used to be to 1 block, but having multiple points at