Advertisement
PHOBOSS

Untitled

Apr 25th, 2022 (edited)
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. local component = require("component")
  2. local event = require("event")
  3. local assembler = component.assembler
  4. local modem = component.modem
  5. local craftChannel = 10000
  6. modem.open(craftChannel)
  7.  
  8. function craftHandler(evt,l_addr,r_addr,port,dist,msg,...)
  9. if port == craftChannel and msg == "craft" then
  10. while true do
  11. if assembler.status() == "idle" then
  12. modem.send(l_addr,craftChannel,"idle")
  13. assembler.start()
  14. print("crafted")
  15. return
  16. end
  17. modem.send(l_addr,craftChannel,"busy")
  18. os.sleep(0.5)
  19. end
  20. end
  21. end
  22.  
  23. event.listen("modem_message",craftHandler)
  24.  
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement