Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Config
- os.loadAPI("LightCtrl")
- --os.loadAPI("DoorCtrl")
- rs.setOutput("left", true)
- -- Globals
- me = string.format("%04d", os.getComputerID())
- comm = {}
- function decodeBCast(message)
- local i = 0
- if type(message) == "string" then
- for w in string.gmatch(message, "%w+") do
- comm[i] = w
- i = i+1
- end
- if comm[1] == me then
- return true
- end
- end
- return false
- end
- while true do
- local senderId, message, protocol = rednet.receive()
- if protocol == "LightControl" and LightCtrl.enabled == true then
- if decodeBCast(message) == true then
- LightCtrl.process(comm)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement