DanielBoling

Turtle Quarry 1.0 (Not Tested)

Jan 26th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. -- Main Function
  2.  
  3. function main()
  4.     display()
  5.     print("Quarry will consist of a 16x16 square...")
  6.     print("Please place ender-chest in slot 16...")
  7.     event, key = os.pullEvent("key")
  8.     if key == "keys.space" do
  9.         x,y,z = gps.locate(5)
  10.         if not x then
  11.             print("GPS did not work...")
  12.         end
  13.         result = 256*y
  14.         if turtle.getFuelLevel() < result then
  15.             print("Not enough fuel for entire quarry...")
  16.             print("Please insert fuel...")
  17.             print("Press SPACE to proceed...")
  18.             event, key == os.pullEvent("key") do
  19.             if key == "keys.space" then
  20.                 main()
  21.             end
  22.         end
  23.         quarry()
  24.     end
  25. end
  26.  
  27. -- Mini Functions
  28.  
  29. function quarry()
  30.     for i = 0,y do
  31.         for w = 1,16 do
  32.             row()
  33.             turtle.turnRight()
  34.             turtle.dig()
  35.             turtle.forward()
  36.             turtle.turnRight()
  37.             turtle.forward()
  38.             row()
  39.             turtle.turnLeft()
  40.             turtle.dig()
  41.             turtle.forward()
  42.             turtle.turnLeft()
  43.             turtle.forward()
  44.         end
  45.         turtle.select(16)
  46.         turtle.select(1)
  47.         for e = 1,16 do
  48.             turtle.select(e)
  49.             turtle.drop()
  50.         end
  51.         turtle.select(16)
  52.         turtle.dig()
  53.         turtle.select(1)
  54.     end
  55. end
  56.  
  57. function row()
  58.     for q = 1,16 do
  59.         turtle.digUp()
  60.         turtle.digDown()
  61.         turtle.dig()
  62.         turtle.forward()
  63.     end
  64. end
  65. function display()
  66.     term.clear()
  67.     term.setCursorPos(1,1)
  68.     print("Quarry Miner 1.0")
  69. end
  70.  
  71. -- Function List
  72.  
  73. main()
Advertisement
Add Comment
Please, Sign In to add comment