PHOBOSS

Drone_BRAIN_2.lua

Apr 6th, 2022 (edited)
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. local m=component.proxy(component.list("modem")())
  2. local d=component.proxy(component.list("drone")())
  3. d.setLightColor(0x00FFE8) -- the first character 's' of the method should have been in lower case
  4. d.setStatusText(d.name()) -- same here... my bad
  5. m.open(2412)
  6. m.setWakeMessage("RISE")
  7. local function respond(...)
  8. local args=table.pack(...)
  9. pcall(function() m.broadcast(2000, table.unpack(args)) end)--needed to broadcast to a different channel to avoid drones yelling at each other about recursive error messages
  10. end
  11. local function receive()
  12. while true do
  13. local evt,_,_,_,_,cmd=computer.pullSignal()
  14. if evt=="modem_message" then return load(cmd) end
  15. end
  16. end
  17. while true do
  18. local result,reason=pcall(function()
  19. local result,reason=receive()
  20. if not result then return respond(reason) end
  21. respond(result())
  22. end)
  23. if not result then respond(reason) end
  24. end
Add Comment
Please, Sign In to add comment