osmarks

ARC Beacon

Jul 30th, 2018
1,592
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local ms = {peripheral.find "modem"}
  2. local f = fs.open(... or "conf.tbl", "r")
  3. local conf = loadstring("return " .. f.readAll())
  4. f.close()
  5.  
  6. if not conf or not conf() then error "Configuration file invalid" end
  7. if #ms < 1 then error "Add a modem" end
  8.  
  9. local pos = {gps.locate()}
  10.  
  11. while true do
  12.     local actual_config = conf()
  13.     actual_config.ID = os.getComputerID()
  14.     actual_config.location = pos
  15.     for _, m in pairs(ms) do
  16.         m.transmit(666, 666, actual_config)
  17.     end
  18.     print("Transmitting at", os.clock())
  19.     sleep(actual_config.sleep_time or 3)
  20. end
RAW Paste Data