Advertisement
Adriano98

Turtle crea gallerie più scarico alla chest

Feb 23rd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. Slot = 1
  2. Scarico = false
  3. lunghezza = 0
  4.  
  5. function contaSlot()
  6.     slotPieni = 0
  7.     for i = 1,16 do
  8.         if turtle.getItemCount(Slot) > 0 then
  9.             slotPieni = slotPieni + 1
  10.         end
  11.         Slot = Slot + 1
  12.     end
  13.     if slotPieni == 16 then
  14.         Scarico = true
  15.     else
  16.         slotPieni = 0
  17.     end
  18.     Slot = 1
  19. end
  20.  
  21. function avanti()
  22.     turtle.forward()
  23. end
  24.  
  25. function indietro()
  26.     turtle.back()
  27. end
  28.  
  29. function destra()
  30.     turtle.turnRight()
  31. end
  32.  
  33. function sinistra()
  34.     turtle.turnLeft()
  35. end
  36.  
  37. function up()
  38.      turtle.up()
  39. end
  40.  
  41. function down()
  42.   turtle.down()
  43. end
  44.  
  45. function scava()
  46.    
  47.     turtle.dig()
  48.     avanti()
  49.     sinistra()
  50.     turtle.dig()
  51.     turtle.digUp()
  52.     up()
  53.     turtle.dig()
  54.     turtle.digUp()
  55.     up()
  56.     turtle.dig()
  57.     destra()
  58.     destra()
  59.     turtle.dig()
  60.     down()
  61.     turtle.dig()
  62.     down()
  63.     turtle.dig()
  64.     sinistra()
  65. end
  66.  
  67. while true do
  68.     scava()
  69.     lunghezza = lunghezza + 1
  70.     contaSlot()
  71.    
  72.     if Scarico == true then
  73.         for y = 1,lunghezza do
  74.             indietro()
  75.         end
  76.         sinistra()
  77.         sinistra()
  78.         for z = 1,16 do
  79.             turtle.select(Slot)
  80.             turtle.drop()
  81.             Slot = Slot + 1
  82.         end
  83.         Slot = 1
  84.         sinistra()
  85.         sinistra()
  86.    
  87.         for x = 1,lunghezza do
  88.             avanti()
  89.         end
  90.         Slot = 1
  91.         Scarico = false
  92.     end
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement