Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- enableRaw = false -- Enables interception of Raw EAS transmissions (Beta)
- p = "easp"
- isDebugging = false
- function openModems()
- for _, v in pairs(rs.getSides()) do
- if peripheral.getType(v) == "modem" then
- rednet.open(v)
- print("DEBUG: Attempted to open modem on side: "..v)
- end
- end
- end
- function react(msg)
- if term.isColour() then
- term.setTextColor(colors.orange)
- end
- print("["..textutils.formatTime(os.time(), false).."] "..msg)
- pulse(10, "back")
- term.setTextColor(colors.white)
- end
- function pulse(sec, side)
- local num = sec
- while true do
- local oldNum = num
- redstone.setOutput(side,true)
- sleep(0.5)
- redstone.setOutput(side,false)
- sleep(0.5)
- num = oldNum - 1
- if num == 0 then break end
- end
- end
- openModems()
- if args[1] == "-debug" or args[2] == "-debug" then isDebugging = true end
- if args[1] == "-raw" or args[2] == "-raw" then enableRaw = true end
- term.clear()
- term.setCursorPos(1, 1)
- print("EAS Decoder v1.0")
- print("["..textutils.formatTime(os.time(), false).."] Started EAS decoder")
- if isDebugging then
- if term.isColour() then
- print("["..textutils.formatTime(os.time(), false).."] DEBUG: EAS decoder is working on an Advanced PC")
- end
- end
- if enableRaw then print("["..textutils.formatTime(os.time(), false).."] EAS Decoder is working in Raw mode") end
- if enableRaw then p = "easraw" end
- while true do
- senderId, message, protocol = rednet.receive(p)
- if isDebugging then print("["..textutils.formatTime(os.time(), false).."] DEBUG: Received EAS transmission from "..senderId) end
- react(message)
- end
Add Comment
Please, Sign In to add comment