netripper

Computercraft - dig

Nov 11th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. -- dig
  2.  
  3. function forward()
  4.   while turtle.detect() do
  5.     turtle.dig()
  6.     os.sleep(0.5)
  7.   end
  8.   while not turtle.forward() do turtle.dig() end
  9. end
  10.  
  11. function back()
  12.   if not turtle.back() then
  13.     turtle.turnLeft()
  14.     turtle.turnLeft()
  15.     forward()
  16.     turtle.turnRight()
  17.     turtle.turnRight()
  18.   end
  19. end
  20.  
  21. function leftWithoutMoving()
  22.   turtle.turnLeft()
  23.   while turtle.detect() do
  24.     turtle.dig()
  25.     os.sleep(0.5)
  26.   end
  27.   turtle.turnRight()
  28. end
  29.  
  30. function rightWithoutMoving()
  31.   turtle.turnRight()
  32.   while turtle.detect() do
  33.     turtle.dig()
  34.     os.sleep(0.5)
  35.   end
  36.   turtle.turnLeft()
  37. end
  38.  
  39. function up()
  40.   while turtle.detectUp() do
  41.     turtle.digUp()
  42.     os.sleep(0.5)
  43.   end
  44.   while not turtle.up() do turtle.digUp() end
  45. end
  46.  
  47. function down()
  48.   while turtle.detectDown() do
  49.     turtle.digDown()
  50.   end
  51.   while not turtle.down() do turtle.digDown() end
  52. end
Advertisement
Add Comment
Please, Sign In to add comment