Advertisement
gustav9797

floor filler

Jun 25th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. turnLeft = false
  2.  
  3. function checkSlots()
  4. for i=2,16 do
  5. if turtle.getItemCount(i) > 0 then
  6. turtle.select(i)
  7. break;
  8. end
  9. print("Ran out of filling material, noob!")
  10. end
  11. end
  12.  
  13. function checkFuel()
  14. if turtle.getFuelLevel() < 100 then
  15. turtle.select(1)
  16. if not turtle.refuel(turtle.getItemCount(1)) then
  17. print("Ran out of fuel, noob!")
  18. end
  19. end
  20. end
  21.  
  22. while true do
  23. while turtle.forward() do
  24. turtle.placeDown()
  25. checkSlots()
  26. checkFuel()
  27. end
  28. if(turnLeft) then
  29. turtle.turnLeft()
  30. turtle.forward()
  31. turtle.turnLeft()
  32. checkSlots()
  33. turtle.placeDown()
  34. turnLeft = false
  35. else
  36. turtle.turnRight()
  37. turtle.forward()
  38. turtle.turnRight()
  39. checkSlots()
  40. turtle.placeDown()
  41. turnLeft = true
  42. end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement