Driftix

Platerform construction turtle (FINI)

Dec 30th, 2018
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.29 KB | None | 0 0
  1. taille_x = 0
  2. taille_y = 0
  3. slot = 0
  4. a = false
  5.  
  6. function tourne()                       --ESQUIVE
  7.   if taille_y % 2   == 0 then
  8.     a = false
  9.   else
  10.     a = true
  11.   end
  12.     if a == false then
  13.       turtle.turnRight()
  14.       turtle.forward()
  15.       turtle.placeDown()
  16.       turtle.turnRight()
  17.     end
  18.     if a == true then
  19.       turtle.turnLeft()
  20.       turtle.forward()
  21.       turtle.placeDown()
  22.       turtle.turnLeft()
  23.     end
  24. end
  25.  
  26. function recherche(nom_bloc)
  27.   while slot <16 do
  28.  
  29.     while turtle.getItemCount() == 0 do
  30.         if slot == 16 then
  31.           slot = 0
  32.         end
  33.         slot = slot +1
  34.         turtle.select(slot)
  35.     end
  36.     local data = turtle.getItemDetail(slot)
  37.     if data.name == nom_bloc then
  38.       turtle.select(slot)
  39.       return 0
  40.     end
  41.     slot = slot +1
  42.     turtle.select(slot)
  43.   end
  44. end
  45.  
  46. function mine(x,y,nom_bloc)
  47.   recherche(nom_bloc)
  48. while taille_y < y  do
  49.   while taille_x < x  do
  50.     if turtle.getItemDetail() == nil then
  51.       recherche(nom_bloc)
  52.     end
  53.     turtle.placeDown()
  54.     turtle.forward()
  55.     taille_x = taille_x +1
  56.     print("x = "..taille_x)
  57.   end
  58.   print("y = "..taille_y)
  59.   tourne()
  60.   taille_y = taille_y + 1
  61.   taille_x = 0
  62. end
  63. end
  64.  
  65. local arg = { ... }
  66. mine(tonumber(arg[1]), tonumber(arg[2]), tostring(arg[3]))
Advertisement
Add Comment
Please, Sign In to add comment