Advertisement
tankflo

Untitled

Apr 25th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 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. print("X=?") --initialisation des coordonée + envoie
  18. X = io.read()
  19. print("Y=?")
  20. Y = io.read()
  21. print("Z=?")
  22. z = io.read()
  23. rednet.send(??,X)
  24. rednet.send(??,Y)
  25. rednet.send(??,Z)
  26.  
  27. while x2==0 and z2==0 do --direction initial
  28. print("direction:")
  29. direction = read()
  30. if direction == "west" then
  31. x2=-1
  32. z2=0
  33. end
  34. if direction == "est" then
  35. x2=1
  36. z2=0
  37. end
  38. if direction == "nord" then
  39. x2=0
  40. z2=-1
  41. end
  42. if direction == "west" then
  43. x2=0
  44. z2=1
  45. end
  46. end
  47.  
  48. function changement_de_direction() --fonction qui change la direction
  49. if droitegauche == 1 then
  50. if direction == "nord" or direction == "sud" then
  51. x2=z2*(-1)
  52. z2=0
  53. end
  54. if direction == "est" or direction == "ouest" then
  55. x2=z
  56. z2=0
  57. end
  58. end
  59. if droitegauche == 0 then
  60. if direction == "nord" or direction == "sud" then
  61. x2=0
  62. z2=z2*(-1)
  63. end
  64. if direction == "est" or direction == "ouest" then
  65. x2=0
  66. z2=z
  67. end
  68. end
  69. end
  70.  
  71. while a==1 do --Début des préparatif
  72. turtle.select(16)
  73. turtle.refuel(3)
  74. turtle.digUp()
  75. turtle.select(13)
  76. turtle.placeUp()
  77. while bedrock==0 do --Quand la turtle dans déssendre
  78. turtle.select(8)
  79. if turtle.compareDown()then
  80. bedrock=1
  81. end
  82. turtle.digDown()
  83. turtle.down()
  84. while compteur<4 do
  85. compteur = compteur + 1
  86. while block<8 do
  87. turtle.select(block)
  88. block = block + 1
  89. if turtle.compare() then
  90. turtle.dig()
  91. end
  92. end
  93. block=1
  94. turtle.turnRight()
  95. end
  96. compteur=0
  97. turtle.select(8)
  98. end
  99.  
  100. while bedrock==1 do --quand la turtle se vide et se déplace en surface
  101. turtle.select(13)
  102. if turtle.compareUp()then
  103. while block<13 do
  104. turtle.select(block)
  105. block = block + 1
  106. turtle.dropUp(63-turtle.getItemSpace())
  107. end
  108. block=1
  109. turtle.select(12)
  110. turtle.transferTo(16,63-turtle.getItemSpace())
  111. bedrock=0
  112. else
  113. turtle.digUp()
  114. turtle.up()
  115. end
  116. if bedrock==0 then
  117. if tour==compteur2 then
  118. tour=tour+2
  119. compteur2=1
  120. if droitegauche==1 then
  121. turtle.turnRight()
  122. changement_de_direction()
  123. turtle.dig()
  124. turtle.forward()
  125. turtle.dig()
  126. turtle.forward()
  127. turtle.dig()
  128. turtle.forward()
  129. turtle.turnRight()
  130. changement_de_direction()
  131. droitegauche=0
  132. else
  133. turtle.turnLeft()
  134. changement_de_direction()
  135. turtle.dig()
  136. turtle.forward()
  137. turtle.dig()
  138. turtle.forward()
  139. turtle.dig()
  140. turtle.forward()
  141. turtle.turnLeft()
  142. changement_de_direction()
  143. droitegauche=1
  144. end
  145. else
  146. coin=(tour+2)/2
  147. if coin==compteur2 then
  148. if droitegauche==0 then
  149. turtle.turnRight()
  150. changement_de_direction()
  151. else
  152. turtle.turnLeft()
  153. changement_de_direction()
  154.  
  155. end
  156. end
  157. end
  158. compteur2=compteur2+1
  159. turtle.dig()
  160. turtle.forward()
  161. turtle.dig()
  162. turtle.forward()
  163. turtle.dig()
  164. turtle.forward()
  165. turtle.placeUp()
  166. X=x2+X
  167. Z=z2+Z
  168. rednet.send(??,X)
  169. rednet.send(??,Y)
  170. rednet.send(??,Z)
  171. end
  172. end
  173. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement