Advertisement
Guest User

catalogue

a guest
Feb 23rd, 2014
4,783
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. rednet.open("right")
  2. local c = peripheral.wrap("bottom")
  3. local a = peripheral.wrap("front")
  4. local f = peripheral.wrap("top")
  5. local redstoneDir = "back"
  6. --Added this incase you are pastebinning the code
  7. local beans = {}
  8.  
  9. function scanSlot(slot)
  10.     c.pushItem("up", slot,1)
  11.     turtle.drop()
  12.     data = a.getAspects()
  13.     beans[data] = slot
  14.     turtle.suck()
  15.     c.pullItemIntoSlot("up", 1, 1,slot)
  16. end  
  17.  
  18. function scanSlots()
  19.    redstone.setOutput(redstoneDir, true)
  20.    for i = 1, 55 do
  21.       if c.getStackInSlot(i) then
  22.          scanSlot(i)
  23.       end
  24.    end
  25.    redstone.setOutput(redstoneDir, false)
  26. end
  27.  
  28. function essentia(aspect, numAspect)
  29.    if not f.getStackInSlot(1) then
  30.       c.pushItemIntoSlot("up", beans[aspect], numAspect,1)
  31.       redstone.setOutput("left", true)
  32.       sleep(1)
  33.       redstone.setOutput("left", false)
  34.       sleep(3)
  35.       --f.pullItemIntoSlot("down", 1, numAspect,1)  
  36.    end
  37.    while f.getStackInSlot(1) do
  38.       print("Waiting for empty furnace....")
  39.       sleep(3)
  40.    end
  41. --   sleep(15)
  42. end
  43.  
  44. function awaitRednet()
  45.   local id, msg, dist = rednet.receive()
  46. --  term.write(msg)
  47.   local essData = {}
  48.   essData = textutils.unserialize(msg)
  49.   print(essData[1]..":"..essData[2])
  50.   essentia(essData[1], essData[2])
  51.   rednet.send(id, "Complete")
  52. end
  53.  
  54. scanSlots()
  55. while true do
  56.    awaitRednet()
  57. end
  58. --essentia("lucrum", 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement