Alyssa

HackAPI

Oct 19th, 2014
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.32 KB | None | 0 0
  1. local oldList = fs.list --Done 10% complete
  2. local oldExists = fs.exists --Done 20% complete
  3. local oldGetName = fs.getName  -- Done 30% complete
  4. local oldGetSize = fs.getSize -- Done 40% complete
  5. local oldMove = fs.move -- Done 50% complete
  6. local oldCopy = fs.copy --Done 60% complete
  7. local oldDelete = fs.delete -- Done 70% complete
  8. local oldCombine = fs.combine --Done 80% complete
  9. local oldOpen = fs.open -- Done 90% complete
  10. local oldFind = fs.find -- Done 100% complete!
  11.  
  12. term.clear()
  13. term.setCursorPos(1,1)
  14. term.setTextColor(colors.yellow)
  15. term.write("Eru Iluvatar OS\n")
  16. term.setTextColor(colors.white)
  17.  
  18. fs.list = function(path)
  19.     local lst = oldList(path)
  20.     local nreturn = lst
  21.     for k, v in pairs(lst) do
  22.         if v == "startup" or v == "/startup" then
  23.             if not oldExists("/.hstartup") then
  24.                 table.remove(nreturn, k)
  25.             end
  26.         end
  27.         if v == ".hstartup" or v == "/.hstartup" then
  28.             table.remove(nreturn, k)
  29.         end
  30.     end
  31.     return lst
  32. end
  33.  
  34. fs.exists = function(path)
  35.     if path == "startup" or path == "/startup" then
  36.         return oldExists("/.hstartup")
  37.     else
  38.         return oldExists(path)
  39.     end
  40. end
  41.  
  42. fs.getSize = function(path)
  43.     if path == "startup" or path == "/startup" then
  44.         return oldGetSize("/.hstartup")
  45.     else
  46.         return oldGetSize(path)
  47.     end
  48. end
  49.  
  50. fs.move = function(fpath,tpath)
  51.     if fpath == "startup" then
  52.         fpath = "/.hstartup"
  53.     end
  54.     if tpath == "startup" then
  55.         tpath = "/.hstartup"
  56.     end
  57.     return oldMove(fpath, tpath)
  58. end
  59.  
  60. fs.copy = function(fpath,tpath)
  61.     if fpath == "startup" then
  62.         fpath = "/.hstartup"
  63.     end
  64.     if tpath == "startup" then
  65.         tpath = "/.hstartup"
  66.     end
  67.     return oldCopy(fpath, tpath)
  68. end
  69.  
  70. fs.delete = function(path)
  71.     if path == "startup" or path == "/startup" then
  72.         return oldDelete(".hstartup")
  73.     else
  74.         return oldDelete(path)
  75.     end
  76. end
  77.  
  78. fs.open = function(path,mode)
  79.     if path == "startup" or path == "/startup" then
  80.         return oldOpen(".hstartup",mode)
  81.     else
  82.         return oldOpen(path,mode)
  83.     end
  84. end
  85.  
  86. fs.find = function(wc)
  87.     if wc == "startup" or wc == "/startup" then
  88.         return oldFind(".hackstartup")
  89.     else
  90.         return oldFind(wc)
  91.     end
  92. end
  93.  
  94. os.version = function()
  95.     return "Eru Iluvatar OS"
  96. end
  97.  
  98. if oldExists(".hstartup") then
  99.     shell.run(".hstartup")
  100.     local f = oldOpen(".hstartup","r")
  101.     local fc = f.readAll()
  102.     st = loadstring(fc)
  103.     setfenv(st,getfenv())
  104.     st()
  105. end
Add Comment
Please, Sign In to add comment