Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --RSP Server
- side = peripheral.find("modem")
- rednet.open(side)
- idp = {}
- function func()
- rednet.host("rspserv",tostring(os.getComputerID()))
- function snd(arg)
- for i,v in ipairs(idp) do
- rednet.send(v,arg)
- end
- end
- oldShutdown = os.shutdown
- function os.shutdown()
- rednet.unhost("rspserv",tostring(os.getComputerID()))
- sleep(0.5)
- oldShutdown()
- end
- nx, ny = term.getSize()
- function term.getSize()
- return nx, ny
- end
- oldR = os.reboot
- function os.reboot()
- rednet.unhost("rspserv",tostring(os.getComputerID()))
- sleep(0.5)
- oldReboot()
- end
- oldw = term.write
- function term.write(t)
- oldw(t)
- snd({"write",t})
- end
- olds = term.scroll
- function term.scroll(t)
- olds(t)
- snd({"scroll",t})
- end
- oldp = term.setCursorPos
- function term.setCursorPos(t,y)
- oldp(t,y)
- snd({"pos",t,y})
- end
- oldcl = term.clear
- function term.clear()
- oldcl()
- snd({"clear"})
- end
- oldColor = term.isColor
- function term.isColor()
- return true
- end
- oldbc = term.setBackgroundColor
- function term.setBackgroundColor(t)
- if oldColor() then
- oldbc(t)
- end
- snd({"bc",t})
- end
- oldtc = term.setTextColor
- function term.setTextColor(t)
- if oldColor() then
- oldtc(t)
- end
- snd({"tc",t})
- end
- term.setTextColour = term.setTextColor
- term.setBackgroundColour = term.setBackgroundColor
- term.isColour = term.isColor
- oldcl = term.clearLine
- function term.clearLine()
- oldcl()
- snd({"cl"})
- end
- oldbl = term.setCursorBlink
- function term.setCursorBlink(b)
- oldbl(b)
- snd({"bl",b})
- end
- oldPull = os.pullEventRaw
- function os.pullEventRaw(f)
- while true do
- local e = {oldPullRaw()}
- if e[1] == "rednet_message" then
- if type(e[3]) == "table" then
- if e[3][1] == "key" then
- return "key",e[3][2]
- elseif e[3][1] == "char" then
- return "char",e[3][2]
- elseif e[3][1] == "init" then
- local canz = true
- for i, v in pairs(idp) do
- if v == e[2] then
- canz = false
- end
- end
- if canz then
- table.insert(idp,e[2])
- end
- nx, ny = e[3][2], e[3][3]
- term.clear()
- term.setCursorPos(1,1)
- elseif e[3][1] == "label" then
- rednet.send(e[2],{os.getComputerLabel()})
- elseif e[3][1] == "dc" then
- local canz = true
- for i, v in pairs(idp) do
- if v == e[2] then
- table.remove(idp,i)
- end
- end
- else
- return unpack(e)
- end
- end
- end
- return unpack(e)
- end
- end
- end
- parallel.waitForAll((function() sleep(0.5) term.clear() term.setCursorPos(1,1) shell.run("shell")),func)
Advertisement
Add Comment
Please, Sign In to add comment