Advertisement
Guest User

map

a guest
Apr 29th, 2015
518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 32.41 KB | None | 0 0
  1. function onStartup()
  2. -- Made by Danick10
  3. -- Type of biodiversity
  4. -- 1 == grassy
  5. -- 2 == desert
  6. -- 3 == jungle
  7. -- 4 == snow
  8. -- 5 == plain
  9. -- 6 == water
  10. -- incoming biodiversity
  11. -- 7 == swamp
  12. -- 8 == dead land
  13. -- 9 == rocky
  14. -- 10 == lava burning
  15. -- north        = 0
  16. -- east            = 1
  17. -- south        = 2
  18. -- west            = 3
  19. local config_chunk_number = 5  --- determine how many biodome are created --> Example  -- config_chunk_number = 5 -- Then 5x5  = 25 biodome created!
  20. local config_chunk_size = 50   --- determine the width of a biodome --> Example -- config_chunk_size = 50 -- then biodome is 50x50 tile..
  21.  
  22. local config_water_seed = 10              --- how many river seeds are created   ---> example -- config_water_seed = 10-- 10 river are created around the map
  23. 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!
  24. 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!
  25. local config_rocks_density = 15         --- I think you get it,
  26. local config_snowyrocks_density = 8
  27. local config_yellowtufts_density = 3
  28. local config_deserttree_density = 15
  29. local config_jungletree_density = 4
  30. local config_snowtree_density = 10
  31. local config_plaintree_density = 7
  32. local config_watertree_density = 4
  33. local config_bluegem_density = 100 --- Spawn 1 bluegem every xx tile....
  34. local config_redgem_density = 40
  35. local config_greengem_density = 40
  36.  
  37.  
  38.  
  39.  
  40.  
  41. 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}
  42. local GREENTUFTS = {[0] = 6216, [1] = 6217, [2] = 6218, [3] = 6219}
  43. 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}
  44. 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}
  45. 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}
  46. local SNOWTREE = {[0] = 7020, [1] = 7021, [2] = 7022, [3] = 7023, [4] = 2698, [5] = 2697}
  47. local PLAINTREE = {[0] = 10741, [1] = 10742, [2] = 10743, [3] = 2737, [4] = 2738, [5] = 2739, [6] = 2740}
  48. local YELLOWTUFTS = {[0] = 10737, [1] = 10738, [2] = 10739, [3] = 10740}
  49. local ROCKS = {[0] = 1293, [1] = 1294, [2] = 1295, [3] = 1335, [4] = 1356, [5] = 1357, [6] = 1358, [7] = 1359, [8] = 1353, [9] = 1285}
  50. local SNOWYROCKS = {[0] = 6999, [1] = 7000, [2] = 7001, [3] = 7002, [4] = 7003, [5] = 6712, [6] = 6713, [7] = 6714, [8] = 6715, [9] = 6716}
  51. local BLUEGEM = {[0] = 8633, [1] = 8637}
  52. local REDGEM = {[0] = 8635, [1] = 8639}
  53. local GREENGEM = {[0] = 8636, [1] = 8640}
  54.  
  55.  
  56.  
  57.                 for chunk_x=0,config_chunk_number do              
  58.                 for chunk_y=0,config_chunk_number do
  59.                 local bio = math.random(1, 6)
  60.  
  61. for z=7,15 do
  62.     for x=chunk_x*config_chunk_size,chunk_x*config_chunk_size+config_chunk_size - 1 do
  63.         for y=chunk_y*config_chunk_size,chunk_y*config_chunk_size+config_chunk_size -1 do
  64.                 -- declaring all items ID          
  65.                 local pos = Position(x,y,z)
  66.                 local mountain_tile = 919
  67.                 local grass_tile = math.random(4526, 4541)
  68.                 local water_tile = math.random(4623, 4625)  
  69.                 local sand_tile = 231
  70.                 local jungle_tile = 3263
  71.                 local snow_tile = math.random(6580, 6593)
  72.                 local plain_tile = math.random(8328, 8331)          
  73.                 local cave_tile = math.random(9026, 9041)
  74.                 local green_tree = math.random(0,12)
  75.                 local desert_tree = math.random(0,13)  
  76.                 local jungle_tree = math.random(0,21)
  77.                 local water_tree = math.random(0,15)
  78.                 local snow_tree = math.random(0,5)
  79.                 local plain_tree = math.random(0,6)              
  80.                 local green_tufts = math.random(0,3)          
  81.                 local rocks = math.random(0,9)              
  82.                 local snowyrocks = math.random(0,9)  
  83.                 local yellow_tufts = math.random(0,3)          
  84.                 local blue_gem = math.random(0,1)
  85.                 local red_gem = math.random(0,1)
  86.                 local green_gem = math.random(0,1)
  87.                
  88.                 if z == 7 then              
  89.                     newtile = Game.createTile(pos)
  90.                    
  91.                             if bio == 1 then -- grassy biodome
  92.                             -- Create tile, tree, rocks, etc      
  93.                             tree_ = math.random(1,config_tree_density)
  94.                             rocks_ = math.random(1,config_rocks_density)
  95.                             tufts_ = math.random(1,config_tufts_density)
  96.                             Game.createItem(grass_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
  97.  
  98.                                 if tree_ == 1 then -- add a tree
  99.                                 Game.createItem(GREENTREE[green_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
  100.                                 elseif rocks_ == 1 then
  101.                                 Game.createItem(ROCKS[rocks], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})          
  102.                                 elseif tufts_ == 1 then
  103.                                 Game.createItem(GREENTUFTS[green_tufts], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  104.                                 end
  105.    
  106.                                 if newtile:getPosition().x == chunk_x*config_chunk_size then
  107.                                     border1_ = math.random(1,3)
  108.                                     border2_ = math.random(1,2)  
  109.                                     if border1_ ~= 3 then
  110.                                     Game.createItem(grass_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
  111.                                     if border2_ == 1 then
  112.                                     Game.createItem(grass_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
  113.                                     end
  114.                                     end
  115.                                 end  
  116.                                 if newtile:getPosition().y == chunk_y*config_chunk_size then
  117.                                     border1_ = math.random(1,3)
  118.                                     border2_ = math.random(1,2)              
  119.                                     if border1_ ~= 3 then
  120.                                     Game.createItem(grass_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y  - 1, z=newtile:getPosition().z})
  121.                                     if border2_ == 1 then
  122.                                     Game.createItem(grass_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
  123.                                     end
  124.                                     end
  125.                                 end  
  126.                            
  127.                                
  128.                             elseif bio    == 2 then -- desert biodome
  129.                                 -- Create tile, tree, rocks, etc.            
  130.                             deserttree_ = math.random(1,config_deserttree_density)
  131.                             rocks_ = math.random(1,config_rocks_density)
  132.                             yellowtufts_ = math.random(1,config_yellowtufts_density)
  133.                             Game.createItem(sand_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
  134.  
  135.                                 if deserttree_ == 1 then -- add a tree
  136.                                 Game.createItem(DESERTTREE[desert_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
  137.                                 elseif rocks_ == 1 then
  138.                                 Game.createItem(ROCKS[rocks], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})          
  139.                                 elseif yellowtufts_ == 1 then
  140.                                 Game.createItem(YELLOWTUFTS[yellow_tufts], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  141.                                 end      
  142.                                
  143.  
  144.                                 if newtile:getPosition().x == chunk_x*config_chunk_size then
  145.                                     border1_ = math.random(1,3)
  146.                                     border2_ = math.random(1,2)                                  
  147.                                     if border1_ ~= 3 then
  148.                                     Game.createItem(sand_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
  149.                                     if border2_ == 1 then
  150.                                     Game.createItem(sand_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
  151.                                     end
  152.                                     end
  153.                                 end  
  154.                                 if newtile:getPosition().y == chunk_y*config_chunk_size then
  155.                                     border1_ = math.random(1,3)
  156.                                     border2_ = math.random(1,2)  
  157.                                     if border1_ ~= 3 then
  158.                                     Game.createItem(sand_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y  - 1, z=newtile:getPosition().z})
  159.                                     if border2_ == 1 then
  160.                                     Game.createItem(sand_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
  161.                                     end
  162.                                     end
  163.                                 end      
  164.                                
  165.                                
  166.                                
  167.                             elseif bio    == 3 then -- jungle biodome
  168.                                 -- Create tile, tree, rocks, etc.            
  169.                             jungletree_ = math.random(1,config_jungletree_density)
  170.                             rocks_ = math.random(1,config_rocks_density)
  171.                             tufts_ = math.random(1,config_tufts_density)
  172.                             Game.createItem(jungle_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
  173.  
  174.                                 if jungletree_ == 1 then -- add a tree
  175.                                 Game.createItem(JUNGLETREE[jungle_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
  176.                                 elseif rocks_ == 1 then
  177.                                 Game.createItem(ROCKS[rocks], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})          
  178.                                 elseif tufts_ == 1 then
  179.                                 Game.createItem(GREENTUFTS[green_tufts], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  180.                                 end  
  181.                                                            
  182.                                 if newtile:getPosition().x == chunk_x*config_chunk_size then
  183.                                     border1_ = math.random(1,3)
  184.                                     border2_ = math.random(1,2)      
  185.                                     if border1_ ~= 3 then
  186.                                     Game.createItem(jungle_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
  187.                                     if border2_ == 1 then
  188.                                     Game.createItem(jungle_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
  189.                                     end
  190.                                     end
  191.                                 end  
  192.                                 if newtile:getPosition().y == chunk_y*config_chunk_size then
  193.                                     border1_ = math.random(1,3)
  194.                                     border2_ = math.random(1,2)  
  195.                                     if border1_ ~= 3 then
  196.                                     Game.createItem(jungle_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y  - 1, z=newtile:getPosition().z})
  197.                                     if border2_ == 1 then
  198.                                     Game.createItem(jungle_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
  199.                                     end
  200.                                     end
  201.                                 end  
  202.                                            
  203.  
  204.                             elseif bio    == 4 then -- snow biodome
  205.                                 -- Create tile, tree, rocks, etc.            
  206.                             snowtree_ = math.random(1,config_snowtree_density)
  207.                             snowyrocks_ = math.random(1,config_snowyrocks_density)
  208.                             Game.createItem(snow_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
  209.  
  210.                                 if snowtree_ == 1 then -- add a tree
  211.                                 Game.createItem(SNOWTREE[snow_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
  212.                                 elseif snowyrocks_ == 1 then
  213.                                 Game.createItem(ROCKS[rocks], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                                  
  214.                                 end
  215.                                
  216.                                 if newtile:getPosition().x == chunk_x*config_chunk_size then
  217.                                     border1_ = math.random(1,3)
  218.                                     border2_ = math.random(1,2)      
  219.                                     if border1_ ~= 3 then
  220.                                     Game.createItem(snow_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
  221.                                     if border2_ == 1 then
  222.                                     Game.createItem(snow_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
  223.                                     end
  224.                                     end
  225.                                 end  
  226.                                 if newtile:getPosition().y == chunk_y*config_chunk_size then
  227.                                     border1_ = math.random(1,3)
  228.                                     border2_ = math.random(1,2)  
  229.                                     if border1_ ~= 3 then
  230.                                     Game.createItem(snow_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y  - 1, z=newtile:getPosition().z})
  231.                                     if border2_ == 1 then
  232.                                     Game.createItem(snow_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
  233.                                     end
  234.                                     end
  235.                                 end  
  236.                                
  237.                                
  238.                             elseif bio    == 5 then -- plain biodome
  239.                                 -- Create tile, tree, rocks, etc.            
  240.                             plaintree_ = math.random(1,config_plaintree_density)
  241.                             rocks_ = math.random(1,config_rocks_density)
  242.                             tufts_ = math.random(1,config_tufts_density)
  243.                             Game.createItem(plain_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
  244.  
  245.                                 if plaintree_ == 1 then -- add a tree
  246.                                 Game.createItem(PLAINTREE[plain_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
  247.                                 elseif rocks_ == 1 then
  248.                                 Game.createItem(ROCKS[rocks], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  249.                                 elseif tufts_ == 1 then
  250.                                 Game.createItem(GREENTUFTS[green_tufts], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                                  
  251.                                 end
  252.                                
  253.                                 if newtile:getPosition().x == chunk_x*config_chunk_size then
  254.                                     border1_ = math.random(1,3)
  255.                                     border2_ = math.random(1,2)      
  256.                                     if border1_ ~= 3 then
  257.                                     Game.createItem(plain_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
  258.                                     if border2_ == 1 then
  259.                                     Game.createItem(plain_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
  260.                                     end
  261.                                     end
  262.                                 end  
  263.                                
  264.                                 if newtile:getPosition().y == chunk_y*config_chunk_size then
  265.                                     border1_ = math.random(1,3)
  266.                                     border2_ = math.random(1,2)  
  267.                                     if border1_ ~= 3 then
  268.                                     Game.createItem(plain_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y  - 1, z=newtile:getPosition().z})
  269.                                     if border2_ == 1 then
  270.                                     Game.createItem(plain_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
  271.                                     end
  272.                                     end
  273.                                 end  
  274.                                
  275.                             elseif bio    == 6 then -- water biodome
  276.                                 -- Create tile, tree, rocks, etc.            
  277.                             watertree_ = math.random(1,config_watertree_density)                          
  278.                             Game.createItem(water_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})
  279.  
  280.                                 if watertree_ == 1 then -- add a tree
  281.                                 Game.createItem(WATERTREE[water_tree], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  282.                                 end      
  283.                                 if newtile:getPosition().x == chunk_x*config_chunk_size then
  284.                                     border1_ = math.random(1,3)
  285.                                     border2_ = math.random(1,2)      
  286.                                     if border1_ ~= 3 then
  287.                                     Game.createItem(water_tile, 1, {x=newtile:getPosition().x - 1, y=newtile:getPosition().y, z=newtile:getPosition().z})
  288.                                     if border2_ == 1 then
  289.                                     Game.createItem(water_tile, 1, {x=newtile:getPosition().x - 2, y=newtile:getPosition().y, z=newtile:getPosition().z})
  290.                                     end
  291.                                     end
  292.                                 end  
  293.                                 if newtile:getPosition().y == chunk_y*config_chunk_size then
  294.                                     border1_ = math.random(1,3)
  295.                                     border2_ = math.random(1,2)  
  296.                                     if border1_ ~= 3 then
  297.                                     Game.createItem(water_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y  - 1, z=newtile:getPosition().z})
  298.                                     if border2_ == 1 then
  299.                                     Game.createItem(water_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y - 2, z=newtile:getPosition().z})
  300.                                     end
  301.                                     end
  302.                                 end                              
  303.                         end      
  304.  
  305.                 elseif z > 7 then
  306.                 ------------------------------------------
  307.                 if z == 8 then
  308.                 newtile = Game.createTile(pos)
  309.                 Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  310.                 bluegem_ = math.random(1,config_bluegem_density*8)
  311.                 redgem_ = math.random(1,config_redgem_density*8)
  312.                 greengem_ = math.random(1,config_greengem_density*8)
  313.                 if bluegem_ == 1 then -- add a tree
  314.                 Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  315.                 elseif redgem_ == 1 then
  316.                 Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  317.                 elseif greengem_ == 1 then
  318.                 Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  319.                 end      
  320.                 end
  321.                 --------------------------------------------
  322.                 if z == 9 then
  323.                 newtile = Game.createTile(pos)
  324.                 Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  325.                 bluegem_ = math.random(1,config_bluegem_density*7)
  326.                 redgem_ = math.random(1,config_redgem_density*7)
  327.                 greengem_ = math.random(1,config_greengem_density*7)
  328.                 if bluegem_ == 1 then -- add a tree
  329.                 Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  330.                 elseif redgem_ == 1 then
  331.                 Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  332.                 elseif greengem_ == 1 then
  333.                 Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  334.                 end      
  335.                 end
  336.                 -------------------------------------------
  337.                 if z == 10 then
  338.                 newtile = Game.createTile(pos)
  339.                 Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  340.                 bluegem_ = math.random(1,config_bluegem_density*6)
  341.                 redgem_ = math.random(1,config_redgem_density*6)
  342.                 greengem_ = math.random(1,config_greengem_density*6)
  343.                 if bluegem_ == 1 then -- add a tree
  344.                 Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  345.                 elseif redgem_ == 1 then
  346.                 Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  347.                 elseif greengem_ == 1 then
  348.                 Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  349.                 end      
  350.                 end
  351.                 -------------------------------------------
  352.                 if z == 11 then
  353.                 newtile = Game.createTile(pos)
  354.                 Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  355.                 bluegem_ = math.random(1,config_bluegem_density*5)
  356.                 redgem_ = math.random(1,config_redgem_density*5)
  357.                 greengem_ = math.random(1,config_greengem_density*5)
  358.                 if bluegem_ == 1 then -- add a tree
  359.                 Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  360.                 elseif redgem_ == 1 then
  361.                 Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  362.                 elseif greengem_ == 1 then
  363.                 Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  364.                 end      
  365.                 end
  366.                 --------------------------------------------
  367.                 if z == 12 then
  368.                 newtile = Game.createTile(pos)
  369.                 Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  370.                 bluegem_ = math.random(1,config_bluegem_density*4)
  371.                 redgem_ = math.random(1,config_redgem_density*4)
  372.                 greengem_ = math.random(1,config_greengem_density*4)
  373.                 if bluegem_ == 1 then -- add a tree
  374.                 Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  375.                 elseif redgem_ == 1 then
  376.                 Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  377.                 elseif greengem_ == 1 then
  378.                 Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  379.                 end      
  380.                 end
  381.                 -------------------------------------------
  382.                 if z == 13 then
  383.                 newtile = Game.createTile(pos)
  384.                 Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  385.                 bluegem_ = math.random(1,config_bluegem_density*2)
  386.                 redgem_ = math.random(1,config_redgem_density*2)
  387.                 greengem_ = math.random(1,config_greengem_density*2)
  388.                 if bluegem_ == 1 then -- add a tree
  389.                 Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  390.                 elseif redgem_ == 1 then
  391.                 Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  392.                 elseif greengem_ == 1 then
  393.                 Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  394.                 end      
  395.                 end
  396.                 -----------------------------------------
  397.                 if z == 14 then
  398.                 newtile = Game.createTile(pos)
  399.                 Game.createItem(cave_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  400.                 bluegem_ = math.random(1,config_bluegem_density)
  401.                 redgem_ = math.random(1,config_redgem_density)
  402.                 greengem_ = math.random(1,config_greengem_density)
  403.                 if bluegem_ == 1 then -- add a tree
  404.                 Game.createItem(BLUEGEM[blue_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  405.                 elseif redgem_ == 1 then
  406.                 Game.createItem(REDGEM[red_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  407.                 elseif greengem_ == 1 then
  408.                 Game.createItem(GREENGEM[green_gem], 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})                  
  409.                 end      
  410.                 end
  411.                 -------------------------------------------
  412.                 if z == 15 then
  413.                 newtile = Game.createTile(pos)
  414.                 Game.createItem(mountain_tile, 1, {x=newtile:getPosition().x, y=newtile:getPosition().y, z=newtile:getPosition().z})  
  415.                 end
  416.                 ----------------------------------------------
  417.                 end
  418.            
  419. end -- end for y
  420. end -- end for x
  421. end -- end for z
  422. end -- end for chunky
  423. end -- end for chunkx
  424.                         ---------------------------------------------------------------------------          
  425.                                         --- Water seeds --- By Danck10          
  426.                 seed = 0                                  
  427.                 repeat
  428.                 local water_tile = math.random(4623, 4625)  
  429.                 posx =    math.random(config_chunk_size,config_chunk_size*config_chunk_number - config_chunk_size)
  430.                 posy =  math.random(config_chunk_size,config_chunk_size*config_chunk_number - config_chunk_size)
  431.                 posz =  7
  432.                 dir =  math.random(0,3)
  433.                 Game.createItem(water_tile, 1, {x=posx, y=posy, z=posz})
  434.                
  435.                 print("--->" .. posx .."-".. posy.."-".. posz .. "- river was succesfully seeded!")
  436.                 repeat
  437. local pos_ = {x=posx,y=posy,z=posz}
  438. local items = Tile(pos_):getItems()
  439. if items ~= nil then
  440.     for i = 1, #items do
  441.     items[i]:remove()
  442.     end      
  443.     end
  444.                 Game.createItem(water_tile, 1, {x=posx, y=posy, z=posz})
  445.                     if dir ==  0 then
  446.                         newdir = math.random(0,7)
  447.                         if newdir == 0 then
  448.                             posx = posx -1
  449.                         elseif newdir == 1 then
  450.                             posx = posx + 1
  451.                         else
  452.                         posy = posy -1  
  453.                         end
  454.                     elseif dir == 1 then
  455.                         newdir =    math.random(0,7)
  456.                         if newdir == 0 then
  457.                             posy = posy -1
  458.                         elseif newdir == 1 then
  459.                             posy = posy + 1    
  460.                         else
  461.                             posx = posx +1
  462.                         end                  
  463.                     elseif dir == 2 then
  464.                         newdir =    math.random(0,7)
  465.                         if newdir == 0 then
  466.                             posx = posx -1  
  467.                         elseif newdir == 1 then
  468.                             posx = posx + 1
  469.                         else
  470.                             posy = posy +1  
  471.                         end              
  472.                     elseif dir == 3 then
  473.                     newdir =    math.random(0,7)
  474.                         if newdir == 0 then
  475.                             posy = posy -1  
  476.                         elseif newdir == 1 then
  477.                             posy = posy + 1    
  478.                         else
  479.                             posx = posx -1
  480.                         end
  481.                     end      
  482.                 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
  483.                 seed = seed+1
  484.                 until seed == config_water_seed                  
  485.         end            -----------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement