hevohevo

ComputerCraft Tutorial: rotational boring_testcode

Feb 12th, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. -- ##################################
  2. -- rotational boring
  3. -- this is test code.
  4. -- http://hevohevo.hatenablog.com/
  5.  
  6. -- main
  7. local MIN_FUEL_LEVEL = 300
  8. local FUEL_SLOT = 16
  9. i=0
  10. function myRefuel()
  11.   print("Fuel slot is ",FUEL_SLOT)
  12.   turtle.select(FUEL_SLOT)
  13.   while true do
  14.     turtle.refuel()
  15.     print("Current fuel level is ", turtle.getFuelLevel())
  16.     if turtle.getFuelLevel() > MIN_FUEL_LEVEL then break end
  17.     os.pullEvent("turtle_inventory")
  18.   end
  19. end
  20.  
  21. function digAndDown()
  22.   for i=1,4 do
  23.     turtle.dig()
  24.     turtle.turnRight()
  25.   end
  26.   turtle.digDown()
  27.   return turtle.down()
  28. end
  29.  
  30. function recursive_trip()
  31.   if digAndDown() then
  32.     recursive_trip()
  33.     turtle.up()
  34.   end
  35.   return
  36. end
  37.  
  38. function trip()
  39.   local depth = 0
  40.   while digAndDown() do
  41.     depth = depth + 1
  42.   end
  43.   for i=1, dpeth do
  44.     turtle.up()
  45.   end
  46. end
  47.  
  48. myRefuel()
  49. turtle.select(1)
  50. trip()
  51. --recursive_trip()
Advertisement
Add Comment
Please, Sign In to add comment