TheKojent

miner

Apr 1st, 2013
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. os.loadAPI("try")
  2. local done = false
  3. local tArgs = { ... }
  4. if #tArgs ~= 2 then
  5.   print("Usage: miner <shaft depth> <quarry width>")
  6.   return
  7. end
  8. count = tonumber(tArgs[1])
  9. width = tonumber(tArgs[2])
  10. term.clear()
  11. term.setCursorPos(1,1)
  12. print("Place chest in slot 1, bucket of water in slot 2. Press any key to continue.")
  13. os.pullEvent()
  14. for i = 1, count - 2 do
  15.   if not try.down() then
  16.     print("Cannot go down!")
  17.     return
  18.   end
  19. end
  20. if not try.dig() then
  21.   print("Cannot mine block!")
  22.   return
  23. end
  24. for i = 1,2 do
  25.   if not try.down() then
  26.     print("Cannot go down!")
  27.     return
  28.   end
  29.   turtle.select(3 - i)
  30.   if not try.place() then
  31.     print("Cannot place block!")
  32.     return
  33.   end
  34. end
  35. turtle.select(2)
  36. turtle.drop()
  37. turtle.turnLeft()
  38. turtle.turnLeft()
  39. shell.run("excavate", width)
Advertisement
Add Comment
Please, Sign In to add comment