Tweak tsm_railcorridors for faster mapgen

This just does 5 instead of 10 attempts to spawn a corridor in a
chunk. There still appear to be plenty corridors and it makes
mapgen noticeably faster.
This commit is contained in:
cora 2022-07-02 00:21:47 +02:00
parent d6306d78b8
commit db4f2baafc

View file

@ -1102,7 +1102,9 @@ mcl_mapgen_core.register_generator("railcorridors", nil, function(minp, maxp, bl
local buffer = 5 local buffer = 5
-- Do up to 10 tries to start a corridor system -- Do up to 10 tries to start a corridor system
for t=1,10 do -- 5 Still seems to generate a lot of them and
-- makes this noticeably faster.
for t=1,5 do
-- Get semi-random height in mapchunk -- Get semi-random height in mapchunk
local y = pr:next(minp.y + buffer, maxp.y - buffer) local y = pr:next(minp.y + buffer, maxp.y - buffer)
y = math.floor(math.max(height_min + buffer, math.min(height_max - buffer, y))) y = math.floor(math.max(height_min + buffer, math.min(height_max - buffer, y)))