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:
parent
caf4282689
commit
32d31426c9
9
init.lua
9
init.lua
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user