Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local hostid = (server id here)
- local blockoutgoing = false
- local blockincoming = false
- function captureSend(id, msg)
- local tMessages = {id, msg}
- local message = textutils.serialize(tMessages)
- rednet.send(hostid, message)
- if blockoutgoing == false then
- rednet.send(id, msg)
- end
- end
- function captureBC(msg)
- rednet.send(hostid, msg)
- if blockoutgoing == false then
- rednet.broadcast(msg)
- end
- end
- function captureIncoming(timeout)
- local id, msg, distance = rednet.receive(timeout)
- if id ~= nil and msg ~= nil and distance ~= nil then
- local received = {id, msg, distance}
- received = textutils.serialize(received)
- rednet.send(hostid, received)
- end
- if blockincoming == false then
- return id, msg, distance
- end
- end
- function capturePE(filter)
- event, p1, p2, p3, p4, p5 = os.pullEvent(filter)
- if event == "rednet_message" then
- local received = {p1, p2, p3}
- received = textutils.serialize(received)
- rednet.send(hostid, received)
- end
- return event, p1, p2, p3, p4, p5
- end
- rednet.send = captureSend
- rednet.broadcast = captureBC
- rednet.receive = captureIncoming
- os.pullEvent = capturePE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement