Advertisement
Guest User

digStairs.lua

a guest
Feb 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. function checkFuel(amount)
  2.     if turtle.getFuelLevel() < amount*6 then
  3.         return false
  4.     else
  5.         return true
  6.     end
  7. end
  8. function Up()
  9.  if not turtle.up() then
  10.   turtle.digUp()
  11.   Up()
  12.  end
  13. end
  14. function Down()
  15.  if not turtle.down() then
  16.   turtle.digDown()
  17.   Down()
  18.  end
  19. end
  20. function Forward()
  21.  if not turtle.forward() then
  22.   turtle.dig()
  23.   Forward()
  24.  end
  25. end
  26. function stairDown(amount)
  27.  for i=1,amount do
  28.   Forward()
  29.   Up()
  30.   turtle.digUp()
  31.   Down()
  32.   Down()
  33.  end
  34. end
  35. print("How many blocks Down:")
  36. local amount = read()
  37. if checkFuel(amount) then
  38.     fuelStart = turtle.getFuelLevel()
  39.     stairDown(amount)
  40.     print("--------DONE----------")
  41.     print(fuelStart - turtle.getFuelLevel() .." Fuel used")
  42. else
  43.     print("Not enoth Fuel," ..amount*6 .." required")
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement