Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for x = 0, editor.worldSize do
- local s = x / editor.worldSize -- range from 0 to 1
- linex[ #linex + 1 ] = x * editor.tdefsize
- liney[ #liney + 1 ] = love.math.noise( 10 * s + 20, seed) * 1250
- liney[ #liney ] = roundTo( liney[ #liney ], editor.tdefsize )
- local biomeNum = round( biomey[ x ], 3 )
- if biomeNum > 0 and biomeNum < 5 then -- PLAINS GENERATION
- if liney[ #liney ] < 300 then
- spawnBlock( linex[ #linex ], liney[ #liney ], blocks.snowGrass, chunk )
- else
- spawnBlock( linex[ #linex ], liney[ #liney ], blocks.grass, chunk )
- end
- if love.math.random( 1, 10 ) == 3 then
- local ypos
- for i = 1, love.math.random( 4, 5 ) do
- spawnBlock( linex[ #linex ], liney[ #liney ] - ( i * editor.tdefsize ), blocks.treeLog, chunk )
- ypos = liney[ #liney ] - ( i * editor.tdefsize )
- end
- for i = 1, 3 do
- spawnBlock( linex[ #linex ] - editor.tdefsize * 2 + ( i * editor.tdefsize), ypos, blocks.treeLeaves, chunk )
- end
- spawnBlock( linex[ #linex ], ypos - editor.tdefsize, blocks.treeLeaves, chunk )
- else
- local r = love.math.random( 1, 10 )
- if liney[ #liney ] > 500 then
- if r == 1 or r == 2 then
- spawnBlock( linex[ #linex ], liney[ #liney ] - editor.tdefsize, blocks.weeds, chunk )
- elseif r == 5 then
- spawnBlock( linex[ #linex ], liney[ #liney ] - editor.tdefsize, blocks.rose, chunk )
- end
- end
- end
- elseif biomeNum >= 5 and biomeNum < 8 then --DESERT GENERATION
- spawnBlock( linex[ #linex ], liney[ #liney ], blocks.sand, chunk )
- if love.math.random( 1, 16 ) == 3 then
- for i = 1, love.math.random( 2, 3 ) do
- spawnBlock( linex[ #linex ], liney[ #liney ] - ( i * editor.tdefsize ), blocks.treeCactus, chunk )
- end
- end
- elseif biomeNum >= 8 and biomeNum < 10 then --SWAMP GENERATION
- if liney[ #liney ] < 300 then
- spawnBlock( linex[ #linex ], liney[ #liney ], blocks.snowGrass, chunk )
- else
- spawnBlock( linex[ #linex ], liney[ #liney ], blocks.swampGrass, chunk )
- end
- if love.math.random( 1, 10 ) == 3 then
- local ypos
- for i = 1, love.math.random( 3, 4 ) do
- spawnBlock( linex[ #linex ], liney[ #liney ] - ( i * editor.tdefsize ), blocks.treeLog, chunk )
- ypos = liney[ #liney ] - ( i * editor.tdefsize )
- end
- for i = 1, 5 do
- spawnBlock( linex[ #linex ] - editor.tdefsize * 3 + ( i * editor.tdefsize), ypos, blocks.treeLeaves, chunk )
- end
- for i = 1, 3 do
- spawnBlock( linex[ #linex ] - editor.tdefsize * 2 + ( i * editor.tdefsize), ypos - editor.tdefsize, blocks.treeLeaves, chunk )
- end
- spawnBlock( linex[ #linex ], ypos - editor.tdefsize, blocks.treeLeaves, chunk )
- end
- end
- local toBottom = 3000 - liney[ #liney ]
- local toBottom = toBottom / editor.tdefsize
- for i = 1, toBottom do
- local block
- if biomeNum > 0 and biomeNum < 5 then
- local depth = love.math.random( 5, 9 )
- if i < depth then
- spawnBlock( linex[ #linex ], liney[ #liney ] + ( i * editor.tdefsize ), blocks.dirt, chunk )
- elseif i >= depth then
- local block = generateOre( i + depth )
- if block == "none" then
- spawnBlock( linex[ #linex ], liney[ #liney ] + ( i * editor.tdefsize ), blocks.stone, chunk )
- else
- spawnBlock( linex[ #linex ], liney[ #liney ] + ( i * editor.tdefsize ), block, chunk )
- print( "Generated ore " .. block.name )
- end
- end
- elseif biomeNum >= 5 and biomeNum < 8 then
- local depth = love.math.random( 7, 8 )
- if i < depth then
- spawnBlock( linex[ #linex ], liney[ #liney ] + ( i * editor.tdefsize ), blocks.sand, chunk )
- elseif i >= depth and i < round( depth + depth / 2 ) then
- spawnBlock( linex[ #linex ], liney[ #liney ] + ( i * editor.tdefsize ), blocks.sandstone, chunk )
- else
- spawnBlock( linex[ #linex ], liney[ #liney ] + ( i * editor.tdefsize ), blocks.stone, chunk )
- end
- elseif biomeNum >= 8 and biomeNum < 10 then
- local depth = love.math.random( 5, 9 )
- if i < depth then
- spawnBlock( linex[ #linex ], liney[ #liney ] + ( i * editor.tdefsize ), blocks.dirt, chunk )
- elseif i >= depth then
- spawnBlock( linex[ #linex ], liney[ #liney ] + ( i * editor.tdefsize ), blocks.stone, chunk )
- end
- end
- end
- chunkCount = chunkCount + 1
- if chunkCount > editor.chunkSize then
- chunk = chunk + 1
- chunkCount = 0
- if chunks[ chunk ] == nil then
- chunks[ chunk ] = { x = linex[ #linex ], tiles = { } }
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement