Guest User

compbox

a guest
Jan 31st, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. function cPrint(y, text)
  2.   size = term.getSize()
  3.   term.setCursorPos(size/2-math.floor(#text/2), y)
  4.   write(text)
  5. end
  6.  
  7. local oldOpen = fs.open
  8. local oldDelete = fs.delete
  9. local oldMove = fs.move
  10. local oldCopy = fs.copy
  11.  
  12. fs.open = function(fileName, mode)
  13.   if fileName:sub(1, 3) == "rom" or fileName:sub(1, 5) == "disk2" then
  14.     return oldOpen(fileName, mode)
  15.   else
  16.     return false
  17.   end
  18. end
  19.  
  20. fs.delete = function(fileName)
  21.   if fileName:sub(1, 5) == "disk2" then
  22.     return oldDelete(fileName)
  23.   else
  24.     return false
  25.   end
  26. end
  27.  
  28. fs.move = function(fileName, destination)
  29.   if fileName:sub(1, 5) == "disk2" then
  30.     return oldMove(fileName, destination)
  31.   else
  32.     return false
  33.   end
  34. end
  35.  
  36. fs.copy = function(fileName, destination)
  37.   if fileName:sub(1, 5) == "disk2" then
  38.     return oldCopy(fileName, destination)
  39.   else
  40.     return false
  41.   end
  42. end
  43.  
  44. term.clear()
  45. cPrint(5, "Public Computer Box")
  46. cPrint(6, "Step in and press any key")
  47. local evt = os.pullEvent("key")
  48.  
  49. local timeSite = http.get("http://www.timeapi.org/utc/now?format=%25a%20%25b%20%25d%20%25Y%20%25I:%25M:%25S")
  50. local time = timeSite.readAll()
  51. local logTable = {"Computer Box login", time}
  52. local logString = textutils.serialize(logTable)
  53.  
  54. rednet.open("back")
  55. rednet.send(118, logString)
  56. rednet.close("back")
  57.  
  58. term.clear()
  59. term.setCursorPos(1,1)
  60. print("BoxOS 1.4")
Advertisement
Add Comment
Please, Sign In to add comment