Advertisement
supangan

junikle

May 10th, 2014
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    
  2.  
  3.     turtle.select(1)
  4.     turtle.refuel()
  5.      
  6.     local int numSteps = 0
  7.     local remainder = turtle.getFuelLevel() % 2
  8.      
  9.     while ((turtle.getFuelLevel() - remainder) > numSteps) do
  10.             turtle.digDown()
  11.             turtle.digUp()
  12.             moveForward()
  13.             numSteps = numSteps + 1
  14.     end
  15.      
  16.     turtle.turnRight()
  17.     turtle.turnRight()
  18.      
  19.     turtle.digDown()
  20.     turtle.digUp()
  21.      
  22.     while (numSteps > 0) do
  23.             moveForward()
  24.             numSteps = numSteps - 1
  25.     end
  26.      
  27.     local function moveForward()
  28.             while not turtle.forward() do
  29.                     --# check if a block was the cause
  30.                     if turtle.detect() then
  31.                             if not turtle.dig() then
  32.                                     print("An unbreakable block has been encountered, bedrock is that you?")
  33.                             elseif turtle.detect() then
  34.                                     print("Sand/Gravel is falling!")
  35.                                     sleep(0.8)
  36.                             else
  37.                                     print("A block was in my way")
  38.                             end
  39.                     --# check if fuel was the cause
  40.                     elseif turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() == 0 then
  41.                             print("I am out of fuel... HELP!")
  42.                     elseif turtle.attack() then
  43.                             print("Get out of my way mob/player!")
  44.                     end
  45.             end
  46.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement