Advertisement
schwiti100

Stripmining

Jul 13th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.14 KB | None | 0 0
  1. i=8
  2. j=21
  3. k=0
  4. a=0
  5. right=true
  6.  
  7. function fforward()
  8.     while(not turtle.forward()) do
  9.         turtle.dig()
  10.     end
  11.     a=a+1
  12.     while(turtle.detectUp()) do
  13.         turtle.digUp()
  14.         sleep(0.4)
  15.     end
  16.     if not turtle.detectDown() then
  17.         turtle.select(1)
  18.         turtle.placeDown()
  19.     end
  20.     if(a==12) then
  21.         a=0
  22.         placeTorch()
  23.     end
  24. end
  25.  
  26.  
  27.  
  28. function placeTorch()
  29.     turtle.turnRight()
  30.     turtle.turnRight()
  31.     turtle.select(2)
  32.     turtle.place()
  33.     turtle.turnRight()
  34.     turtle.turnRight()
  35. end
  36.  
  37. function Up()
  38.     for e=1,4 do
  39.         while(not turtle.Up) do
  40.             turtle.digUp()
  41.         end
  42.     end
  43.    
  44. end
  45.  
  46. write("cobblestone in slot 1\n")
  47. write("fakeln in slot 2\n")
  48. write("anzahl der stockwerke:")
  49. k=tonumber(read())
  50.  
  51. while(true) do
  52.     for h=1,k do
  53.         for f=1,i do
  54.             for g=1,j do
  55.                 fforward()
  56.             end
  57.             if(f<8) then
  58.                 if right then
  59.                     turtle.turnRight()
  60.                 else    
  61.                     turtle.turnLeft()
  62.                 end
  63.                 fforward()
  64.                 fforward()
  65.                 fforward()
  66.                 if right then
  67.                     turtle.turnRight()
  68.                     right=false
  69.                 else    
  70.                     turtle.turnLeft()
  71.                     right=true
  72.                 end
  73.             else
  74.                 fforward()
  75.                 Up()
  76.                 turtle.turnRight()
  77.                 turtle.turnRight()
  78.             end
  79.         end
  80.     end
  81. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement