SHARE
TWEET

ComputerCraft Tutorial: boring_0_1

hevohevo Feb 14th, 2014 5,144 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- ################################
  2. -- Boring by mining turtle
  3. -- version 0.1a
  4. -- http://hevohevo.hatenablog.com/
  5.  
  6. -- functions
  7. function myRefuel()
  8.   turtle.select(16)  -- fuel item slot is 16
  9.   turtle.refuel()
  10. end
  11.  
  12. function revolve()
  13.   for i=1, 4 do -- dig four sides
  14.     turtle.dig()
  15.     turtle.turnRight()
  16.   end
  17.  
  18.   turtle.digDown() -- dig down side
  19.  
  20.   return turtle.down() -- go down. if failed, return false.
  21. end
  22.  
  23. function backToHome(n)
  24.   for i=1, n do -- back to home position.
  25.     turtle.up()
  26.   end
  27. end
  28.  
  29. -- main
  30. myRefuel()
  31.  
  32. local depth = 0
  33. while revolve() do
  34.   depth = depth +1
  35. end
  36.  
  37. backToHome(depth)
RAW Paste Data
Top