Negasus

ns_sherlok

Nov 22nd, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. function checkFuel()
  2.   if turtle.getFuelLevel() < 10 then
  3.     turtle.select(1);
  4.     turtle.refuel(1);
  5.   end
  6. end
  7.  
  8. function doDig()
  9.   turtle.dig();
  10.   turtle.forward();
  11.   turtle.digUp();
  12.   turtle.digDown();
  13. end
  14.  
  15. local cellFuel = 1;
  16. local cellTorch = 2;
  17.  
  18. function placeTorch()
  19.   if turtle.getItemCount(cellTorch) > 0 then
  20.     turtle.select(cellTorch);
  21.     turtle.placeDown();
  22.     return 1;
  23.   else
  24.     return 0;
  25.   end
  26. end
  27.  
  28. local tonnelLength = 10; -- Tonnel length
  29.  
  30. function doWork()
  31.   for i = 1, tonnelLength do
  32.     checkFuel();
  33.     doDig();
  34.     placeTorch();
  35.   end
  36. end
  37.  
  38. doWork();
Advertisement
Add Comment
Please, Sign In to add comment