Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local signalID = "TLS1"
- local signalStatus = false
- local br = peripheral.wrap("back")
- if fs.exists("encrypt") then
- else
- shell.run("pastebin","get", "WRTfH0yx", "encrypt")
- end
- if fs.exists("net") then
- else
- shell.run("pastebin", "get", "EX4jfhA8", "net")
- end
- os.loadAPI("encrypt")
- os.loadAPI("net")
- net.connect("PCS1", "Rifty")
- br.setBundledOutput(0)
- term.setTextColor(colors.green)
- print("Railway block "..signalID.." is active..")
- term.setTextColor(colors.white)
- local function dewSignalling()
- while true do
- sleep(0.5)
- --Do the signalling for the line.
- if br.testBundledInput(colors.red) and signalStatus == false then
- signalStatus = true
- print("Train coming south..")
- br.setBundledOutput(colors.combine(br.getBundledOutput(), colors.lime))
- local send = encrypt.encrypt({signalID = signalID, status = signalStatus}, "nowimafurryrawr")
- net.send("signalUpdate|"..send, 49)
- local fs = fs.open("signalStatus", "w")
- fs.write(signalStatus)
- fs.close()
- end
- if br.testBundledInput(colors.orange) then
- signalStatus = false
- print("Train coming north..")
- br.setBundledOutput(colors.subtract(br.getBundledOutput(), colors.lime))
- local send = encrypt.encrypt({signalID = signalID, status = signalStatus}, "nowimafurryrawr")
- net.send("signalUpdate|"..send, 49)
- local fs = fs.open("signalStatus", "w")
- fs.write(signalStatus)
- fs.close()
- end
- end
- end
- local function dewRednetStuff()
- end
- dewSignalling()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement