Advertisement
sanovskiy

wall

Sep 27th, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. function goForward()
  2.     while not(turtle.forward()) do
  3.         turtle.attack()
  4.     end
  5. end
  6.  
  7. function goDown()
  8.     while not(turtle.down()) do
  9.         turtle.attackDown()
  10.     end
  11. end
  12.  
  13. function goUp()
  14.     while not(turtle.up()) do
  15.         turtle.attackUp()
  16.     end
  17. end
  18.  
  19. function checkMaterial()
  20.     if turtle.getItemCount(curslot)>0 then
  21.         return true
  22.     end
  23.     curslot=curslot+1
  24.     turtle.select(curslot)
  25.     if curslot>14 then
  26.         curslot=1
  27.     end
  28.     return false
  29. end
  30.  
  31. function wall()
  32.     while cutY<height do
  33.         turtle.digUp()
  34.         goUp()
  35.         cutY = cutY+1
  36.         while not(checkMaterial()) do
  37.             sleep(0.1)
  38.         end
  39.         turtle.placeDown()
  40.     end
  41. end
  42.  
  43. curslot=1
  44. turtle.select(curslot)
  45. cutY=0
  46.  
  47. local arg = { ... }
  48. length = tonumber(arg[1])
  49. height = tonumber(arg[2])
  50.  
  51. for curL=1,length,1 do
  52.     turtle.dig()
  53.     goForward()
  54.     while cutY>0 do
  55.         turtle.digDown()
  56.         goDown()
  57.         cutY = cutY-1
  58.     end
  59.     wall()
  60.    
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement