1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-14 22:40:31 +01:00

'Divided' chances for a wrecked boat to appear

- (I hope I got the algorithm right)
 - Solves #188
This commit is contained in:
LeMagnesium 2015-08-02 20:30:05 +02:00
parent 1d85364834
commit d7817ae133

View File

@ -169,7 +169,7 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume,
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
local pr = PseudoRandom(seed) local pr = PseudoRandom(seed)
local num_chunks = math.floor(chunks_per_volume * volume) local num_chunks = math.floor(chunks_per_volume * volume)
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk) local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk) * 10
for i=1,num_chunks do for i=1,num_chunks do
local y0 = pr:next(y_min, y_max-chunk_size+1) local y0 = pr:next(y_min, y_max-chunk_size+1)
if y0 >= height_min and y0 <= height_max then if y0 >= height_min and y0 <= height_max then