Advertisement
Guest User

test

a guest
Oct 7th, 2015
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.77 KB | None | 0 0
  1. -- Variabili
  2. n1=0
  3. -- Torce
  4. function torce(a,b)
  5.  
  6. x=a
  7. i=b
  8. if x==3 and i==13 then
  9.   turtle.select(1)
  10.   turtle.placeDown()
  11. elseif x==4 and i==14 then
  12.   turtle.select(1)
  13.   turtle.placeDown()
  14. elseif x==8 and i==4 then
  15.   turtle.select(1)
  16.   turtle.placeDown()
  17. elseif x==8 and i==8 then
  18.   turtle.select(1)
  19.   turtle.placeDown()
  20. elseif x==8 and i==14 then
  21.   turtle.select(1)
  22.   turtle.placeDown()
  23. elseif x==12 and i==3 then
  24.   turtle.select(1)
  25.   turtle.placeDown()
  26. elseif x==12 and i==6 then
  27.   turtle.select(1)
  28.   turtle.placeDown()
  29. elseif x==12 and i==9 then
  30.   turtle.select(1)
  31.   turtle.placeDown()
  32. elseif x==12 and i==14 then
  33.   turtle.select(1)
  34.   turtle.placeDown()
  35. end
  36.  
  37. end
  38. -- Interfaccia
  39.  
  40. function text()
  41.  
  42. shell.run("clear")
  43. print("Carburante Necessario: 257")
  44.  
  45. end
  46.  
  47. function endtext()
  48.  
  49. shell.run("clear")
  50. print("blocchi scavati: ".. n1)
  51. print("Grazie per aver scelto la Clemente Company")
  52. end
  53.  
  54. -- Svuota
  55.  
  56. function svuota()
  57.   turtle.select(4)
  58.   turtle.placeDown()
  59.   for i=5, 16 do
  60.     turtle.select(i)
  61.     turtle.dropDown(64)
  62.   end
  63.   turtle.select(1)
  64.  
  65. end
  66.  
  67.  
  68. -- Distruggi Cobble
  69.  
  70. function discobble()
  71.    for i=5,16 do
  72.      turtle.select(2)  
  73.      if turtle.compareTo(i) then
  74.        turtle.select(i)
  75.        turtle.dropDown(64)  
  76.      end
  77.    end
  78.    turtle.select(3)
  79.    turtle.placeDown()
  80.    sleep(0.5)
  81.    turtle.placeDown()
  82. end
  83. -- Scavo senza controllo fuel
  84.  
  85. function giulio()
  86.  if turtle.detect() == true then
  87.   turtle.dig()
  88.   n1=n1+1
  89.  end
  90.  if turtle.detectUp() == true then
  91.   turtle.digUp()
  92.   n1=n1+1
  93.  end
  94.  if turtle.detectDown() == true then
  95.   turtle.select(4)
  96.   if turtle.compareDown() == false then
  97.     turtle.digDown()
  98.     n1=n1+1
  99.   end
  100.  end  
  101.  for x=1, 16 do
  102.   for i=1,16 do
  103.     if turtle.detect() == true then
  104.       turtle.dig()
  105.        n1=n1+1
  106.     end  
  107.     turtle.forward()
  108.     if turtle.detectDown() == true then
  109.       turtle.digDown()
  110.       n1=n1+1
  111.     end
  112.     torce(x,i)
  113.     if turtle.detectUp() == true then
  114.       turtle.digUp()
  115.       n1=n1+1
  116.     end
  117.    end
  118.    if x%2 == 0 then
  119.      turtle.turnRight()
  120.      if turtle.detect() == true then
  121.        turtle.dig()
  122.        n1=n1+1
  123.      end
  124.      turtle.forward()
  125.      turtle.turnRight()
  126.      if turtle.detectUp() == true then
  127.        turtle.digUp()
  128.      end
  129.      if turtle.detectDown() == true then
  130.        turtle.digDown()
  131.      end
  132.    else
  133.      turtle.turnLeft()
  134.      if turtle.detect() == true then
  135.        turtle.dig()
  136.        n1=n1+1
  137.      end  
  138.      turtle.forward()
  139.      if turtle.detectUp() == true then
  140.        turtle.digUp()
  141.      end
  142.      if turtle.detectDown() == true then
  143.        turtle.digDown()
  144.      end
  145.      turtle.turnLeft()
  146.  end
  147.   discobble()
  148. end
  149. end
  150.  
  151. -- Input dati
  152.  
  153.  
  154.  
  155. -- Programma Principale
  156.  
  157. text()
  158. giulio()
  159. endtext()
  160. svuota()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement