kreezxil

DigSlave II

May 15th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. blocksmined=0
  2. repeat
  3.   if redstone.getInput("top")then
  4.  
  5.     -- is there a block in front of us
  6.     if turtle.detect() then
  7.  
  8.             if turtle.getFuelLevel() <= 0 then
  9.                print("Out of fuel, please give fuel")
  10.                print("Press a key when fuel has been given")
  11.                os.pullEvent("key")
  12.                for i=1,16 do
  13.                    turtle.select(i)
  14.                    turtle.refuel()
  15.                end
  16.             end
  17.  
  18.             -- increment blocksmined
  19.             blocksmined=blocksmined+1
  20.             turtle.dig()
  21.             turtle.suck()
  22.  
  23.             -- check slot 2 of turtle
  24.             -- if an item is in it then
  25.             -- overflow has occurred
  26.             -- trigger the turtle to take
  27.             -- a dump er leave one.
  28.             if turtle.getItemCount(2)>0 then
  29.                 for slot=1,16 do
  30.                     turtle.select(slot)
  31.                     turtle.dropDown()
  32.                 end
  33.             end
  34.  
  35.       end
  36.  
  37.   else
  38.     break
  39.   end
  40.   term.clear()
  41.   print("Blocksmined")
  42.   print(blocksmined)
  43. until x == 1
Add Comment
Please, Sign In to add comment