Advertisement
Guest User

Tunnel

a guest
Sep 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. os.loadAPI("FuncApi")
  2.  
  3. local args = {...}
  4.  
  5. local usage = "[distance] [wide] [side]"
  6. local side = "right"
  7.  
  8. x = args[1]
  9. y = args[2]
  10. side = args[3]
  11.  
  12. if y == nil then
  13.   y = 1
  14. end
  15.  
  16. FuncApi.argStartup(args, 3, usage)
  17.  
  18. for s = 1,y do
  19.  
  20. for i = 1,x do
  21.   FuncApi.forward(1,"x",1)
  22.   FuncApi.dig(0)
  23.   FuncApi.dig(1)
  24.   FuncApi.checkFuel()
  25.   if (i % 12 == 0) then
  26.     turtle.select(15)
  27.     turtle.placeUp()
  28.     turtle.select(1)
  29.   end
  30. end
  31. FuncApi.gohome(1)
  32. if (side == "left") then
  33.   FuncApi.turnLeft()
  34.   for i = 1,s do
  35.     FuncApi.forward(3,"y",-1)
  36.   end
  37.   FuncApi.turnRight()
  38. elseif ( side == "right") then
  39.   FuncApi.turnRight()
  40.   for i = 1,s do
  41.     FuncApi.forward(3,"y",1)
  42.   end
  43.   FuncApi.turnLeft()
  44. else
  45.   if y ~= 1 then
  46.     error("Not a valid side")
  47.   end
  48. end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement