Advertisement
Guest User

s

a guest
Feb 22nd, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. os.loadAPI("japi")
  2. rednet.open("right")
  3. pipe = peripheral.wrap("back")
  4. atmid = 3738
  5.  
  6.  
  7. lpm = japi.getModule("logisticPipes")
  8. lpm.request.setRequestSide("bottom")
  9. lpm.request.initPipe()
  10.  
  11.  
  12. function empfangen()
  13.     id,redi = rednet.receive()
  14.     if id == atmid then
  15.         data = textutils.unserialize(redi)
  16.         item = data.item
  17.         menge = data.menge
  18.     end
  19. end
  20.  
  21.  while true do
  22.     empfangen()
  23.     if item == "tungsten" then
  24.     lpitems = lpm.request.getItems(false, true)
  25.     lpitem = lpm.convert.getSpecificItem(lpitems, 254)
  26.     --print(textutils.serialize(lpitem))
  27.     if (lpitem ~= nil) then
  28.       if (lpitem.damage == 6 and lpitem.amout >= menge) then
  29.         pipe.makeRequest(pipe.getItemIdentifierIDFor(254, 6), menge)
  30.         --print("requestet")
  31.         rednet.send(atmid, "5")
  32.       else
  33.         rednet.send(atmid, "3")
  34.       end
  35.     else
  36.       rednet.send(atmid, "3")
  37.     end
  38. end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement