babulm

Untitled

Feb 25th, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. os.loadAPI("japi")
  2. rednet.open("top")
  3. pipe = peripheral.wrap("right")
  4. atmid = 3765
  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
Add Comment
Please, Sign In to add comment