Damaged

Grinder manager

May 9th, 2015
468
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. grinder = peripheral.wrap("right")
  2. chest = peripheral.wrap("top")
  3.  
  4. function feedFuel()
  5.   for i,data in pairs(chest.getAllStacks()) do
  6.     print("Looping through chest slot: "..i)
  7.     a = chest.getStackInSlot(i)
  8.     if a.raw_name == "item.item.ethanol" then
  9.       print("Found Ethanol")
  10.       if chest.pushItem("East",i,1) then
  11.         print("Fed engine with fuel")
  12.       end
  13.       break
  14.     end
  15.   end  
  16. end
  17.  
  18.  
  19. while true do
  20.   os.sleep(5)
  21.   a = grinder.printInv()
  22.   if ( a ~= "Empty" ) then
  23.     print("Found grinder to have something")
  24.     a = grinder.getPower()
  25.     if ( a == 0 ) then
  26.       print("Grinder out of energy, feeding")
  27.       feedFuel()
  28.     end
  29.   end
  30. end
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment