Advertisement
Guest User

railway

a guest
Apr 20th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. materials = 0
  2.  
  3. function checkFuel()
  4.   if turtle.getFuelLevel() == 0 then
  5.     selected = turtle.getSelectedSlot()
  6.     turtle.select(16)
  7.     turtle.refuel()
  8.     turtle.select(selected)
  9.   end
  10. end
  11.  
  12. function countMaterials()
  13.   for slot = 1,15 do
  14.     turtle.select(slot)
  15.     item = turtle.getItemDetail()
  16.     if item ~= nil then
  17.       materials = materials + item.count
  18.     end
  19.   end
  20. end  
  21.  
  22. countMaterials()
  23. slot = 1
  24. turtle.select(slot)
  25.  
  26. for i = 1,materials do
  27.   checkFuel()
  28.   if turtle.getItemCount() == 0 then
  29.     slot = slot + 1
  30.     turtle.select(slot)
  31.   end
  32.  
  33.   turtle.placeDown()
  34.   turtle.forward()
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement