Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- blunet
- a new api for rednet
- --]]
- shell.run("pastebin", "get", "QWBSrHDd", "relenc")
- os.loadAPI("relenc")
- blunet = blunet or {}
- blunet.open = function(side)
- rednet.open(side)
- end
- blunet.openAll = function()
- for n,m in ipairs(rs.getSides()) do
- if peripheral.getType(m) == "modem" then
- blunet.open(m)
- end
- end
- end
- blunet.isOpen = function()
- for n,m in ipairs(rs.getSides()) do
- if rednet.isOpen(m) then
- return true
- end
- end
- return false
- end
- blunet.broadcast = function(msg)
- if blunet.isOpen() == false then error("No modem open") end
- rednet.broadcast(relenc.encode(msg))
- end
Add Comment
Please, Sign In to add comment