Guest User

startup

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