Advertisement
tankflo

Untitled

Apr 26th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. a=1 --initialisation des coordonée
  2. verif=0
  3. block=1
  4. compteur=0
  5. bedrock=0
  6. tour=1
  7. droitegauche=1
  8. coin=1
  9. compteur2=1
  10. x2=0
  11. z2=0
  12.  
  13. term.clear()
  14. term.setCursorPos(1,1)
  15. rednet.open("right")
  16.  
  17.  
  18. function envoie()
  19. rednet.send(??,X)
  20. rednet.send(??,Z)
  21. rednet.send(??,Y)
  22. end
  23.  
  24.  
  25.  
  26. function avencer() --fonction qui permet d'avencer tout en envoyent des info au PC central
  27. turtle.forward()
  28. X=x2+X
  29. Z=z2+Z
  30. envoie()
  31. end
  32.  
  33.  
  34.  
  35. function bas() --fonction qui permet de déssendre + envoie
  36. turtle.down()
  37. Y=Y-1
  38. envoie()
  39. end
  40.  
  41.  
  42.  
  43.  
  44. function haut() --fonction qui permet de montée + envoie
  45. turtle.up()
  46. Y=Y+1
  47. envoie()
  48. end
  49.  
  50.  
  51.  
  52.  
  53. function changement_de_direction() --fonction qui change la direction
  54. if droitegauche == 1 then
  55. if direction == "nord" or direction == "sud" then
  56. x2=z2*(-1)
  57. z2=0
  58. if direction == "nord" then
  59. direction = "est"
  60. end
  61. if direction == "sud" then
  62. direction = "west"
  63. end
  64. end
  65. if direction == "est" or direction == "ouest" then
  66. x2=z2
  67. z2=0
  68. if direction == "est" then
  69. direction = "sud"
  70. end
  71. if direction == "west" then
  72. direction = "nord"
  73. end
  74. end
  75. turtle.turnRight()
  76. end
  77.  
  78. if droitegauche == 0 then
  79. if direction == "nord" or direction == "sud" then
  80. x2=0
  81. z2=z2*(-1)
  82. if direction == "nord" then
  83. direction = "ouest"
  84. end
  85. if direction == "sud" then
  86. direction = "est"
  87. end
  88. end
  89. if direction == "est" or direction == "ouest" then
  90. x2=0
  91. z2=z2*(-1)
  92. if direction == "est" then
  93. direction = "nord"
  94. end
  95. if direction == "west" then
  96. direction = "sud"
  97. end
  98. end
  99. turtle.turnLeft()
  100. end
  101. end
  102.  
  103.  
  104. print("X=?") --initialisation des coordonée + envoie
  105. X = io.read()
  106. print("Y=?")
  107. Y = io.read()
  108. print("Z=?")
  109. Z = io.read()
  110. envoie()
  111.  
  112. while x2==0 and z2==0 do --direction initial
  113. print("direction:")
  114. direction = read()
  115. if direction == "west" then
  116. x2=-1
  117. z2=0
  118. end
  119. if direction == "est" then
  120. x2=1
  121. z2=0
  122. end
  123. if direction == "nord" then
  124. x2=0
  125. z2=-1
  126. end
  127. if direction == "west" then
  128. x2=0
  129. z2=1
  130. end
  131. end
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139. while a==a do --Début des préparatif
  140. turtle.select(16)
  141. turtle.refuel(3)
  142. turtle.digUp()
  143. turtle.select(13)
  144. turtle.placeUp()
  145. while bedrock==0 do --Quand la turtle doit déssendre
  146. turtle.select(8)
  147. if turtle.compareDown()then
  148. bedrock=1
  149. end
  150. turtle.digDown()
  151. bas()
  152. while compteur<4 do
  153. compteur = compteur + 1
  154. while block<8 do
  155. turtle.select(block)
  156. block = block + 1
  157. if turtle.compare() then
  158. turtle.dig()
  159. end
  160. end
  161. block=1
  162. changement_de_direction()
  163. end
  164. compteur=0
  165. turtle.select(8)
  166. end
  167.  
  168. while bedrock==1 do --quand la turtle se vide et se déplace en surface
  169. turtle.select(13)
  170. if turtle.compareUp()then
  171. while block<13 do
  172. turtle.select(block)
  173. block = block + 1
  174. turtle.dropUp(63-turtle.getItemSpace())
  175. end
  176. block=1
  177. turtle.select(12)
  178. turtle.transferTo(16,63-turtle.getItemSpace())
  179. bedrock=0
  180. else
  181. turtle.digUp()
  182. haut()
  183. end
  184. if bedrock==0 then
  185. if tour==compteur2 then
  186. tour=tour+2
  187. compteur2=1
  188. if droitegauche==1 then
  189. changement_de_direction()
  190. turtle.dig()
  191. avencer()
  192. turtle.dig()
  193. avencer()
  194. turtle.dig()
  195. avencer()
  196. changement_de_direction()
  197. droitegauche=0
  198. else
  199. changement_de_direction()
  200. turtle.dig()
  201. avencer()
  202. turtle.dig()
  203. avencer()
  204. turtle.dig()
  205. avencer()
  206. changement_de_direction()
  207. droitegauche=1
  208. end
  209. else
  210. coin=(tour+2)/2
  211. if coin==compteur2 then
  212. if droitegauche==0 then
  213. changement_de_direction()
  214. else
  215. changement_de_direction()
  216.  
  217. end
  218. end
  219. end
  220. compteur2=compteur2+1
  221. turtle.dig()
  222. avencer()
  223. turtle.dig()
  224. avencer()
  225. turtle.dig()
  226. avencer()
  227. turtle.placeUp()
  228. end
  229. end
  230. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement