Advertisement
Blackhome

tunnel Mining

Apr 1st, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.22 KB | None | 0 0
  1.     -- Ziel:
  2. --  Alle 3 Felder einen 30 Felder langen Gang
  3. --  Alle 10 Felder im Gang eine Fackel
  4.  
  5. function schlagVorn ()
  6.     while turtle.detect() == true do
  7.         turtle.dig()
  8.         sleep(1)
  9.     end
  10. end
  11.  
  12. function schlagOben()
  13.     while turtle.detectUp() == true do
  14.         turtle.digUp()
  15.         sleep(1)
  16.     end
  17. end
  18.  
  19. function Gang()
  20.     local n = 0;
  21.     while n<30 do
  22.         schlagVorn()
  23.         turtle.forward()
  24.         schlagOben()
  25.         n=n+1
  26.     end
  27.     turtle.up()
  28.     turtle.select(1)
  29.     turtle.placeDown()
  30.     local a=0
  31.     while a < 10 do
  32.         turtle.back()
  33.         a=a+1
  34.     end
  35.     a=0
  36.     turtle.placeDown()
  37.     while a < 10 do
  38.         turtle.back()
  39.         a=a+1
  40.     end
  41.     a=0
  42.     turtle.placeDown()
  43.     while a < 10 do
  44.         turtle.back()
  45.         a=a+1
  46.     end
  47.     a=0
  48.     turtle.down()
  49. end
  50.  
  51. local l = 0
  52. local Richtung = 0
  53. local i =0
  54. print("Geben Sie die Anzahl der Gaenge an, die Sie abfarmen wollen!")
  55. l = tonumber(io.read())
  56. print("Wollen Sie links oder rechts abfarmen?")
  57. print("Druecken Sie die 0 fΓΌr <<links>>, die 1 fΓΌr <<rechts>>")
  58. Richtung = tonumber(io.read())
  59.  
  60. while i<l do
  61.     turtle.forward()
  62.     turtle.forward()
  63.     turtle.forward()
  64.     if Richtung == 0 then
  65.         turtle.turnLeft()
  66.         Gang()
  67.         turtle.turnRight()
  68.     end
  69.     if Richtung == 1 then
  70.         turtle.turnRight()
  71.         Gang()
  72.         turtle.turnLeft()
  73.     end
  74. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement