SHARE
TWEET

Installer (OpenComputers)

Armander May 19th, 2019 (edited) 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local comp = require("component")
  2. local term = require("term")
  3. local computer = require("computer")
  4. local gpu = comp.gpu
  5.  
  6. os.execute("pastebin get -f wRVYU4s0 /home/InstallerList.lua")
  7. package.loaded.BrainInstallerList = nil
  8. local list = require("InstallerList")
  9.  
  10. local mX, mY = gpu.getResolution()
  11. mX = mX/3
  12. mY = mY/3
  13. gpu.setResolution(mX,mY)
  14.  
  15. term.clear()
  16. computer.beep(850,0.15)
  17. computer.beep(1000,0.08)
  18.  
  19. ::SELECT::
  20.  
  21. term.clear()
  22. gpu.setBackground(0x111111)
  23. gpu.fill(1,1,mX,mY," ")
  24. gpu.setForeground(0xDD2222)
  25. gpu.set((mX/2)-7,1,"TERRA INSTALLATOR")
  26. gpu.set((mX/3),3,"Instaluj:")
  27. term.setCursor((mX/3)+10,3)
  28.  
  29. local prog = term.read()
  30. prog = prog:sub(1,-2)
  31. prog = prog:lower()
  32.  
  33. local dl = list[prog]
  34.  
  35. if not list[prog] then
  36.   gpu.set((mX/3),4,"Nieznane")
  37.   computer.beep(300,0.15)
  38.   os.sleep(1)
  39.   goto SELECT
  40. else
  41.     gpu.set((mX/3),4,"Pobieranie")
  42.     computer.beep(900,0.08)
  43. end
  44.  
  45. gpu.setForeground(0x111111)
  46. term.setCursor(1,mY-2)
  47. os.execute("pastebin get -f ".. dl.id .." ".. dl.file)
  48. gpu.setForeground(0xDD2222)
  49. gpu.set((mX/3),5,"Zakonczono")
  50. computer.beep(950,0.08)
  51.  
  52. ::AGAIN::
  53. gpu.fill(1,6,mX,mY," ")
  54. gpu.set((mX/3),6,"Ponownie? [Y/N]")
  55. term.setCursor((mX/3)+16,6)
  56. local again = term.read()
  57. again = again:sub(1,-2)
  58. again = again:lower()
  59.  
  60. if again == "y" then
  61.   computer.beep(900,0.05)
  62.   goto SELECT
  63. elseif again == "n" then
  64.  
  65.   package.loaded.InstallerList = nil
  66.   os.remove("/home/InstallerList.lua")
  67.   computer.beep(900,0.05)
  68. ::REBOOT::
  69.  
  70.   gpu.set((mX/3),7,"Reset? [Y/N]")
  71.   term.setCursor((mX/3)+14,7)
  72.   local reboot = term.read()
  73.   reboot = reboot:sub(1,-2)
  74.   reboot = reboot :lower()
  75.  
  76.   if reboot == "y" then
  77.     for x=0,3 do
  78.       os.sleep(1)
  79.       gpu.set((mX/3),8,"Resetowanie: ".. tostring(3-x))
  80.       computer.beep(750,0.02)
  81.     end
  82.     computer.beep(900,0.05)
  83.     computer.shutdown(true)
  84.   elseif reboot == "n" then
  85.     computer.beep(300,0.2)
  86.     gpu.setBackground(0x000000)
  87.     gpu.setForeground(0xFFFFFF)
  88.     gpu.setResolution(mX*3,mY*3)
  89.     term.clear()
  90.   else
  91.     gpu.fill(mX,7,mX,1," ")
  92.     computer.beep(300,0.15)
  93.     goto REBOOT
  94.   end
  95. else
  96.   computer.beep(300,0.15)
  97.   gpu.fill(mX,6,mX,1," ")
  98.   goto AGAIN
  99. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top