Advertisement
Wassaa

netherstar supply

Aug 2nd, 2014
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. local signalChest = peripheral.wrap("left")
  2. local starChest = peripheral.wrap("top")
  3. local direction = "east"
  4. local generator = peripheral.wrap("generatorfurnace_0")
  5.  
  6. function findSignal()
  7.     if signalChest.getStackInSlot(1) ~= nil then
  8.         --print ("got signal, time to work")
  9.         return true
  10.     else
  11.         print("no signal, keep looking")
  12.         return false
  13.     end
  14. end
  15.  
  16. function feedGenerator()
  17.     if findSignal() then
  18.         print ("got signal, time to work")
  19.         rs.setOutput("right", false)
  20.         if generator.getStackInSlot(1) == nil then
  21.             print(starChest.pushItemIntoSlot(direction,1,1,1))
  22.         else
  23.             print("already have star in the generator")
  24.         end
  25.     else
  26.         rs.setOutput("right", true)
  27.         --generator.pushItemIntoSlot("west",1,1,1)
  28.         print("signal ended, clearing generator")
  29.     end
  30. end
  31.  
  32. while true do
  33.     feedGenerator()
  34.     os.sleep(10)
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement