Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Rednet Cloaking API
- local function generate(recipient, msg, protocol)
- local nMessageID = math.random(1, 2147483647)
- tMessage = {
- nMessageID = nMessageID,
- nRecipient = recipient,
- message = msg,
- sProtocol = protocol,
- }
- return tMessage
- end
- -- cloak.send(side, recipient, message, fake_local_address, [protocol])
- function send(side, recipient, msg, localhost, protocol)
- local reply = localhost
- local tMessage = generate(recipient, msg, protocol)
- local m = peripheral.wrap(side)
- m.transmit(recipient, reply, tMessage)
- end
- -- cloak.toggleListen(channel)
- function toggleListen(channel, side)
- local m = peripheral.wrap(side)
- if channel ~= nil and type(channel) == "number" and m.isOpen(channel) == false then
- m.open(channel)
- elseif channel ~= nil and type(channel) == "number" and m.isOpen(channel, side) == true then
- m.close(channel)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement