thatparadox

PIMcharger

Jul 16th, 2014
275
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pim = peripheral.wrap("front")
  2.  
  3. while true do
  4.     event = os.pullEvent()
  5.     if event == "player_on" then
  6.         rs.setOutput("top",true)
  7.         for slot, contents in pairs(pim.getAllStacks()) do
  8.             for k,v in pairs(pim.getStackInSlot(slot)) do
  9.                 if k == "maxEnergyStored" then
  10.                     maxEng = v
  11.                 elseif k == "energyStored" then
  12.                     eng = v
  13.                     isElectric = true
  14.                 end
  15.             end
  16.             if isElectric == true and eng < maxEng then
  17.                 pim.pushItem("down",slot)
  18.                 event = os.pullEvent()
  19.                 if event == "redstone" then
  20.                     pim.pullItem("down",1,1,slot)
  21.                 end
  22.             end
  23.             isElectric = false
  24.         end
  25.         rs.setOutput("top",false)
  26.     end
  27. end
RAW Paste Data