Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onStartup()
- -- Made by Danick10
- -- Type of biodiversity
- -- 1 == grassy
- -- 2 == desert
- -- 3 == jungle
- -- 4 == snow
- -- 5 == plain
- -- 6 == water
- -- incoming biodiversity
- -- 7 == swamp
- -- 8 == dead land
- -- 9 == rocky
- -- 10 == lava burning
- -- north = 0
- -- east = 1
- -- south = 2
- -- west = 3
- local config_chunk_number = 5 --- determine how many biodome are created --> Example -- config_chunk_number = 5 -- Then 5x5 = 25 biodome created!
- local config_chunk_size = 50 --- determine the width of a biodome --> Example -- config_chunk_size = 50 -- then biodome is 50x50 tile..
- local config_water_seed = 10 --- how many river seeds are created ---> example -- config_water_seed = 10-- 10 river are created around the map
- local config_tree_density = 5 --- determine on how many tile a tree is created ---> example -- config_tree_density = 5 -- then 1 tree is created ever 5 tiles!
- local config_tufts_density = 2 --- determine on how many tile a tufts is created ---> example -- config_tufts_density = 5 -- then 1 tufts is created ever 5 tiles!
- local config_rocks_density = 15 --- I think you get it,
- local config_snowyrocks_density = 8
- local config_yellowtufts_density = 3
- local config_deserttree_density = 15
- local config_jungletree_density = 4
- local config_snowtree_density = 10
- local config_plaintree_density = 7
- local config_watertree_density = 4
- local config_bluegem_density = 100 --- Spawn 1 bluegem every xx tile....
- local config_redgem_density = 40
- local config_greengem_density = 40
- local GREENTREE = {[0] = 2700, [1] = 2701, [2] = 2702, [3] = 2703, [4] = 2705, [5] = 2707, [6] = 2708, [7] = 2709, [8] = 2710, [9] = 2712, [10] = 2768, [11] = 2767, [12] = 2766}
- local GREENTUFTS = {[0] = 6216, [1] = 6217, [2] = 6218, [3] = 6219}
- local DESERTTREE = {[0] = 2723, [1] = 2724, [2] = 2725, [3] = 2726, [4] = 2727, [5] = 2728, [6] = 2729, [7] = 2730, [8] = 2731, [9] = 2732, [10] = 2733, [11] = 2734, [12] = 2735, [13] = 2736}
- local JUNGLETREE = {[0] = 4006, [1] = 4007, [2] = 4008, [3] = 4009, [4] = 4010, [5] = 4011, [6] = 4012, [7] = 4013, [8] = 4014, [9] = 4015, [10] = 4016, [11] = 4017, [12] = 4018, [13] = 4018, [14] = 4019, [15] = 4020, [16] = 4021, [17] = 4022, [18] = 4023, [19] = 4024, [20] = 4025, [21] = 4026}
- local WATERTREE = {[0] = 8632, [1] = 5395, [2] = 5397, [3] = 5398, [4] = 2755, [5] = 2756, [6] = 2757, [7] = 2758, [8] = 2771, [9] = 2772, [10] = 2773, [11] = 2774, [12] = 2775, [13] = 2776, [14] = 2777, [15] = 2778}
- local SNOWTREE = {[0] = 7020, [1] = 7021, [2] = 7022, [3] = 7023, [4] = 2698, [5] = 2697}
- local PLAINTREE = {[0] = 10741, [1] = 10742, [2] = 10743, [3] = 2737, [4] = 2738, [5] = 2739, [6] = 2740}
- local YELLOWTUFTS = {[0] = 10737, [1] = 10738, [2] = 10739, [3] = 10740}
- local ROCKS = {[0] = 1293, [1] = 1294, [2] = 1295, [3] = 1335, [4] = 1356, [5] = 1357, [6] = 1358, [7] = 1359, [8] = 1353, [9] = 1285}
- local SNOWYROCKS = {[0] = 6999, [1] = 7000, [2] = 7001, [3] = 7002, [4] = 7003, [5] = 6712, [6] = 6713, [7] = 6714, [8] = 6715, [9] = 6716}
- local BLUEGEM = {[0] = 8633, [1] = 8637}
- local REDGEM = {[0] = 8635, [1] = 8639}
- local GREENGEM = {[0] = 8636, [1] = 8640}
- for chunk_x=0,config_chunk_number do
- for chunk_y=0,config_chunk_number do
- local bio = math.random(1, 6)
- for z=7,15 do
- for x=chunk_x*config_chunk_size,chunk_x*config_chunk_size+config_chunk_size - 1 do
- for y=chunk_y*config_chunk_size,chunk_y*config_chunk_size+config_chunk_size -1 do
- -- declaring all items ID
- local pos = Position(x,y,z)
- local mountain_tile = 919
- local grass_tile = math.random(4526, 4541)
- local water_tile = math.random(4623, 4625)
- local sand_tile = 231
- local jungle_tile = 3263
- local snow_tile = math.random(6580, 6593)
- local plain_tile = math.random(8328, 8331)
- local cave_tile = math.random(9026, 9041)
- local green_tree = math.random(0,12)
- local desert_tree = math.random(0,13)
- local jungle_tree = math.random(0,21)
- local water_tree = math.random(0,15)
- local snow_tree = math.random(0,5)
- local plain_tree = math.random(0,6)
- local green_tufts = math.random(0,3)
- local rocks = math.random(0,9)
- local snowyrocks = math.random(0,9)
- local yellow_tufts = math.random(0,3)
- local blue_gem = math.random(0,1)
- local red_gem = math.random(0,1)
- local green_gem = math.random(0,1)
- if z == 7 then
- newtile = Game.createTile(pos)
- if bio == 1 then -- grassy biodome
- -- Create tile, tree, rocks, etc
- tree_ = math.random(1,config_tree_density)
- rocks_ = math.random(1,config_rocks_density)
- tufts_ = math.random(1,config_tufts_density)
- Game.createItem(grass_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if tree_ == 1 then -- add a tree
- Game.createItem(GREENTREE[green_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif rocks_ == 1 then
- Game.createItem(ROCKS[rocks], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif tufts_ == 1 then
- Game.createItem(GREENTUFTS[green_tufts], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- if newtile:getPosition().x == chunk_x*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(grass_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(grass_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- end
- if newtile:getPosition().y == chunk_y*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(grass_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 1, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(grass_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
- end
- end
- end
- elseif bio == 2 then -- desert biodome
- -- Create tile, tree, rocks, etc.
- deserttree_ = math.random(1,config_deserttree_density)
- rocks_ = math.random(1,config_rocks_density)
- yellowtufts_ = math.random(1,config_yellowtufts_density)
- Game.createItem(sand_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if deserttree_ == 1 then -- add a tree
- Game.createItem(DESERTTREE[desert_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif rocks_ == 1 then
- Game.createItem(ROCKS[rocks], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif yellowtufts_ == 1 then
- Game.createItem(YELLOWTUFTS[yellow_tufts], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- if newtile:getPosition().x == chunk_x*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(sand_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(sand_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- end
- if newtile:getPosition().y == chunk_y*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(sand_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 1, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(sand_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
- end
- end
- end
- elseif bio == 3 then -- jungle biodome
- -- Create tile, tree, rocks, etc.
- jungletree_ = math.random(1,config_jungletree_density)
- rocks_ = math.random(1,config_rocks_density)
- tufts_ = math.random(1,config_tufts_density)
- Game.createItem(jungle_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if jungletree_ == 1 then -- add a tree
- Game.createItem(JUNGLETREE[jungle_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif rocks_ == 1 then
- Game.createItem(ROCKS[rocks], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif tufts_ == 1 then
- Game.createItem(GREENTUFTS[green_tufts], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- if newtile:getPosition().x == chunk_x*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(jungle_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(jungle_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- end
- if newtile:getPosition().y == chunk_y*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(jungle_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 1, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(jungle_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
- end
- end
- end
- elseif bio == 4 then -- snow biodome
- -- Create tile, tree, rocks, etc.
- snowtree_ = math.random(1,config_snowtree_density)
- snowyrocks_ = math.random(1,config_snowyrocks_density)
- Game.createItem(snow_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if snowtree_ == 1 then -- add a tree
- Game.createItem(SNOWTREE[snow_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif snowyrocks_ == 1 then
- Game.createItem(ROCKS[rocks], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- if newtile:getPosition().x == chunk_x*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(snow_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(snow_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- end
- if newtile:getPosition().y == chunk_y*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(snow_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 1, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(snow_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
- end
- end
- end
- elseif bio == 5 then -- plain biodome
- -- Create tile, tree, rocks, etc.
- plaintree_ = math.random(1,config_plaintree_density)
- rocks_ = math.random(1,config_rocks_density)
- tufts_ = math.random(1,config_tufts_density)
- Game.createItem(plain_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if plaintree_ == 1 then -- add a tree
- Game.createItem(PLAINTREE[plain_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif rocks_ == 1 then
- Game.createItem(ROCKS[rocks], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif tufts_ == 1 then
- Game.createItem(GREENTUFTS[green_tufts], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- if newtile:getPosition().x == chunk_x*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(plain_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(plain_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- end
- if newtile:getPosition().y == chunk_y*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(plain_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 1, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(plain_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
- end
- end
- end
- elseif bio == 6 then -- water biodome
- -- Create tile, tree, rocks, etc.
- watertree_ = math.random(1,config_watertree_density)
- Game.createItem(water_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if watertree_ == 1 then -- add a tree
- Game.createItem(WATERTREE[water_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- if newtile:getPosition().x == chunk_x*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(water_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(water_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- end
- if newtile:getPosition().y == chunk_y*config_chunk_size then
- border1_ = math.random(1,3)
- border2_ = math.random(1,2)
- if border1_ ~= 3 then
- Game.createItem(water_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 1, z=newtile:getPosition().z})
- if border2_ == 1 then
- Game.createItem(water_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
- end
- end
- end
- end
- elseif z > 7 then
- ------------------------------------------
- if z == 8 then
- newtile = Game.createTile(pos)
- Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- bluegem_ = math.random(1,config_bluegem_density*8)
- redgem_ = math.random(1,config_redgem_density*8)
- greengem_ = math.random(1,config_greengem_density*8)
- if bluegem_ == 1 then -- add a tree
- Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif redgem_ == 1 then
- Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif greengem_ == 1 then
- Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- --------------------------------------------
- if z == 9 then
- newtile = Game.createTile(pos)
- Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- bluegem_ = math.random(1,config_bluegem_density*7)
- redgem_ = math.random(1,config_redgem_density*7)
- greengem_ = math.random(1,config_greengem_density*7)
- if bluegem_ == 1 then -- add a tree
- Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif redgem_ == 1 then
- Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif greengem_ == 1 then
- Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- -------------------------------------------
- if z == 10 then
- newtile = Game.createTile(pos)
- Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- bluegem_ = math.random(1,config_bluegem_density*6)
- redgem_ = math.random(1,config_redgem_density*6)
- greengem_ = math.random(1,config_greengem_density*6)
- if bluegem_ == 1 then -- add a tree
- Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif redgem_ == 1 then
- Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif greengem_ == 1 then
- Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- -------------------------------------------
- if z == 11 then
- newtile = Game.createTile(pos)
- Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- bluegem_ = math.random(1,config_bluegem_density*5)
- redgem_ = math.random(1,config_redgem_density*5)
- greengem_ = math.random(1,config_greengem_density*5)
- if bluegem_ == 1 then -- add a tree
- Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif redgem_ == 1 then
- Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif greengem_ == 1 then
- Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- --------------------------------------------
- if z == 12 then
- newtile = Game.createTile(pos)
- Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- bluegem_ = math.random(1,config_bluegem_density*4)
- redgem_ = math.random(1,config_redgem_density*4)
- greengem_ = math.random(1,config_greengem_density*4)
- if bluegem_ == 1 then -- add a tree
- Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif redgem_ == 1 then
- Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif greengem_ == 1 then
- Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- -------------------------------------------
- if z == 13 then
- newtile = Game.createTile(pos)
- Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- bluegem_ = math.random(1,config_bluegem_density*2)
- redgem_ = math.random(1,config_redgem_density*2)
- greengem_ = math.random(1,config_greengem_density*2)
- if bluegem_ == 1 then -- add a tree
- Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif redgem_ == 1 then
- Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif greengem_ == 1 then
- Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- -----------------------------------------
- if z == 14 then
- newtile = Game.createTile(pos)
- Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- bluegem_ = math.random(1,config_bluegem_density)
- redgem_ = math.random(1,config_redgem_density)
- greengem_ = math.random(1,config_greengem_density)
- if bluegem_ == 1 then -- add a tree
- Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif redgem_ == 1 then
- Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- elseif greengem_ == 1 then
- Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- end
- -------------------------------------------
- if z == 15 then
- newtile = Game.createTile(pos)
- Game.createItem(mountain_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
- end
- ----------------------------------------------
- end
- end -- end for y
- end -- end for x
- end -- end for z
- end -- end for chunky
- end -- end for chunkx
- ---------------------------------------------------------------------------
- --- Water seeds --- By Danck10
- seed = 0
- repeat
- local water_tile = math.random(4623, 4625)
- posx = math.random(config_chunk_size,config_chunk_size*config_chunk_number - config_chunk_size)
- posy = math.random(config_chunk_size,config_chunk_size*config_chunk_number - config_chunk_size)
- posz = 7
- dir = math.random(0,3)
- Game.createItem(water_tile, 1, {x=posx, y=posy, z=posz})
- print("--->" .. posx .."-".. posy.."-".. posz .. "- river was succesfully seeded!")
- repeat
- local pos_ = {x=posx,y=posy,z=posz}
- local items = Tile(pos_):getItems()
- if items ~= nil then
- for i = 1, #items do
- items[i]:remove()
- end
- end
- Game.createItem(water_tile, 1, {x=posx, y=posy, z=posz})
- if dir == 0 then
- newdir = math.random(0,7)
- if newdir == 0 then
- posx = posx -1
- elseif newdir == 1 then
- posx = posx + 1
- else
- posy = posy -1
- end
- elseif dir == 1 then
- newdir = math.random(0,7)
- if newdir == 0 then
- posy = posy -1
- elseif newdir == 1 then
- posy = posy + 1
- else
- posx = posx +1
- end
- elseif dir == 2 then
- newdir = math.random(0,7)
- if newdir == 0 then
- posx = posx -1
- elseif newdir == 1 then
- posx = posx + 1
- else
- posy = posy +1
- end
- elseif dir == 3 then
- newdir = math.random(0,7)
- if newdir == 0 then
- posy = posy -1
- elseif newdir == 1 then
- posy = posy + 1
- else
- posx = posx -1
- end
- end
- until posx < 0 or posx > config_chunk_number*config_chunk_size+config_chunk_size or posy < 0 or posy > config_chunk_number*config_chunk_size+config_chunk_size
- seed = seed+1
- until seed == config_water_seed
- end -----------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement