Advertisement
JJAPriestley

Untitled

Dec 18th, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. function setup()
  2. X = 1
  3. Y = 1
  4. Z = 1
  5. Blueprint = {}
  6. xsize = 10
  7. ysize = 20
  8. zsize = 5
  9.  
  10. for xset = 1, xsize do
  11. Blueprint[xset] = {}
  12. for yset = 1, ysize do
  13. Blueprint[xset][yset] = {}
  14. for zset = 1, zsize do
  15. Blueprint[xset][yset][zset] = {}
  16. end
  17. end
  18. end
  19. end
  20.  
  21. function moveto(newx, newy, newz)
  22. move_x = newx - X
  23. move_y = newy - Y
  24. move_z = newz - Z
  25. X = X + move_x
  26. Y = Y + move_y
  27. Z = Z + move_z
  28. if move_x > 0 then
  29. for move = 1, move_x do
  30. turtle.forward()
  31. end
  32. elseif move_x < 0 then
  33. move_x = - move_x
  34. for move = 1, move_x do
  35. turtle.back()
  36. end
  37. end
  38.  
  39. if move_y > 0 then
  40. turtle.turnLeft()
  41. for move = 1, move_y do
  42. turtle.forward()
  43. end
  44. turtle.turnRight()
  45. elseif move_y < 0 then
  46. move_y = - move_y
  47. turtle.turnLeft()
  48. for move = 1, move_y do
  49. turtle.back()
  50. end
  51. turtle.turnRight()
  52. end
  53.  
  54. if move_z > 0 then
  55. for move = 1, move_z do
  56. turtle.up()
  57. end
  58. elseif move_z < 0 then
  59. move_z = - move_z
  60. for move = 1, move_z do
  61. turtle.down()
  62. end
  63. end
  64. end
  65.  
  66. function moveby(newx, newy, newz)
  67. move_x = newx
  68. move_y = newy
  69. move_z = newz
  70. X = X + move_x
  71. Y = Y + move_y
  72. Z = Z + move_z
  73. if move_x > 0 then
  74. for move = 1, move_x do
  75. turtle.forward()
  76. end
  77. elseif move_x < 0 then
  78. move_x = - move_x
  79. for move = 1, move_x do
  80. turtle.back()
  81. end
  82. end
  83.  
  84. if move_y > 0 then
  85. turtle.turnLeft()
  86. for move = 1, move_y do
  87. turtle.forward()
  88. end
  89. turtle.turnRight()
  90. elseif move_y < 0 then
  91. move_y = - move_y
  92. turtle.turnLeft()
  93. for move = 1, move_y do
  94. turtle.back()
  95. end
  96. turtle.turnRight()
  97. end
  98.  
  99. if move_z > 0 then
  100. for move = 1, move_z do
  101. turtle.up()
  102. end
  103. elseif move_z < 0 then
  104. move_z = - move_z
  105. for move = 1, move_z do
  106. turtle.down()
  107. end
  108. end
  109. end
  110.  
  111. function refill()
  112. for s = 2, 16 do
  113. if turtle.getItemSpace() == 64 then
  114. turtle.select(s)
  115. turtle.transferTo(1)
  116. end
  117. end
  118. turtle.select(1)
  119. end
  120.  
  121. function make()
  122. turtle.up()
  123.  
  124. for z = 1, zsize do
  125. for y = 1, ysize do
  126. for x = 1, xsize do
  127. if Blueprint[x][y][z] == 1 then
  128. turtle.placeDown()
  129. refill()
  130. end
  131. turtle.forward()
  132. end
  133. for x = 1, xsize do
  134. turtle.back()
  135. end
  136. turtle.turnLeft()
  137. turtle.forward()
  138. turtle.turnRight()
  139. end
  140. turtle.turnLeft()
  141. for y = 1, ysize do
  142. turtle.back()
  143. end
  144. turtle.turnRight()
  145. turtle.up()
  146. end
  147. end
  148.  
  149. function set()
  150. for xset = 1, 10 do
  151. for yset = 1, 20 do
  152. for zset = 1, 2 do
  153. Blueprint[xset][yset][zset] = 1
  154. end
  155. end
  156. end
  157. for xset = 2, 9 do
  158. for yset = 1, 20 do
  159. for zset = 1, 2 do
  160. Blueprint[xset][yset][zset] = 0
  161. end
  162. end
  163. end
  164.  
  165. for xset = 2, 9 do
  166. for yset = 1, 20 do
  167. Blueprint[xset][yset][3] = 1
  168. end
  169. end
  170. for xset = 3, 8 do
  171. for yset = 1, 20 do
  172. Blueprint[xset][yset][3] = 0
  173. end
  174. end
  175.  
  176. for xset = 3, 8 do
  177. for yset = 1, 20 do
  178. Blueprint[xset][yset][4] = 1
  179. end
  180. end
  181. for xset = 4, 7 do
  182. for yset = 1, 20 do
  183. Blueprint[xset][yset][4] = 0
  184. end
  185. end
  186.  
  187. for xset = 4, 7 do
  188. for yset = 1, 20 do
  189. Blueprint[xset][yset][5] = 1
  190. end
  191. end
  192. end
  193.  
  194. setup()
  195. -- set()
  196. -- make()
  197. moveto(5, 5, 5)
  198. moveby(10, 0, 0)
  199. print("X:"..X.."Y:"..Y.."Z:"..Z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement