MarcosKoco

Make_TRC_Disk

Jun 5th, 2021 (edited)
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.90 KB | None | 0 0
  1. local System = os -- Used for System things like os.time() to System.time()
  2. local Screen = term -- Used for Screen thing on the turtle or computer like term.clear() to Screen.clear()
  3. local Per = peripheral -- Used shortcut for peripheral
  4. local Text = textutils -- Used shortcut for textilils
  5. local Pack = Text.serialize -- Makes a new command for packing ( shortcut used from local Text)
  6. local UnPack = Text.unserialize -- Makes a new command for unpacking ( shortcut used from local Text)
  7.  
  8. local file = fs.exists("/API/Logo.lua")
  9. local file0 = fs.exists("/API/Functions.lua")
  10.  
  11. local Monitor = {}
  12. Monitor[0] = Screen
  13.  
  14. if not(file) then
  15.  
  16.     shell.run("pastebin get s3aBGUVr /API/Logo.lua")
  17.    
  18.     Monitor[0].clear()
  19.     Monitor[0].setCursorPos(1,1)
  20.    
  21. end
  22.  
  23. if not(file0) then
  24.    
  25.     shell.run("pastebin get sujHjqXC /API/Functions.lua")
  26.    
  27.     Monitor[0].clear()
  28.     Monitor[0].setCursorPos(1,1)
  29.    
  30. end
  31.  
  32. System.loadAPI("/API/Logo.lua")
  33. System.loadAPI("/API/Functions.lua")
  34.  
  35. local w, h = Monitor[0].getSize()
  36.  
  37. Monitor[0].clear()
  38.  
  39. Logo.drawLogo(Monitor[0], "Head", math.floor(w/2)-6, math.floor(h/2)-4)
  40.  
  41. local Disk
  42. local DiskName
  43.  
  44. Monitor[0].setCursorPos(1, (h-1))
  45. Monitor[0].clearLine()
  46.  
  47. Functions.SetColors(Monitor[0], colors.white, colors.black)
  48.  
  49. Monitor[0].setCursorPos(math.floor((w - string.len(" Finding Disks ")) /2), (h-1))
  50.  
  51. print(" Finding Disks ")
  52.  
  53. Functions.SetColors(Monitor[0], colors.black, colors.white)
  54.  
  55. for i = 1,6 do
  56.    
  57.     local side
  58.    
  59.     if i == 1 then
  60.         side = "back"
  61.     elseif i == 2 then
  62.         side = "front"
  63.     elseif i == 3 then
  64.         side = "left"
  65.     elseif i == 4 then
  66.         side = "right"
  67.     elseif i == 5 then
  68.         side = "bottom"
  69.     elseif i == 6 then
  70.         side = "top"
  71.     end
  72.    
  73.     if Per.getMethods(side) then
  74.        
  75.         for j,method in pairs(Per.getMethods(side)) do
  76.            
  77.             if (method == 'isDiskPresent') then
  78.                
  79.                 Disk = Per.wrap(side)
  80.                 DiskName = side
  81.                 break
  82.                
  83.             end
  84.            
  85.         end
  86.        
  87.     end
  88.    
  89. end
  90.  
  91. sleep(1)
  92.  
  93. Monitor[0].setCursorPos(1, (h-1))
  94. Monitor[0].clearLine()
  95.  
  96. Functions.SetColors(Monitor[0], colors.white, colors.black)
  97.  
  98. Monitor[0].setCursorPos(math.floor((w - string.len(" Checking disk ")) /2), (h-1))
  99.  
  100. print(" Checking disk ")
  101.  
  102. Functions.SetColors(Monitor[0], colors.black, colors.white)
  103.  
  104. if Disk then
  105.    
  106.     sleep(1)
  107.  
  108.     if Disk.isDiskPresent() then
  109.        
  110.         Monitor[0].setCursorPos(1, (h-1))
  111.         Monitor[0].clearLine()
  112.        
  113.         Functions.SetColors(Monitor[0], colors.white, colors.black)
  114.        
  115.         Monitor[0].setCursorPos(math.floor((w - string.len(" Makes disk ")) /2), (h-1))
  116.        
  117.         print(" Makes disk ")
  118.        
  119.         Functions.SetColors(Monitor[0], colors.black, colors.white)
  120.        
  121.         sleep(1)
  122.        
  123.         disk.setLabel(DiskName, "Setup_TRC_OS")
  124.         local file = fs.exists("/disk/StartUp.lua")
  125.         if file then
  126.             fs.delete("/disk/StartUp.lua")
  127.         end
  128.        
  129.         shell.run("pastebin get TqnHgauG /disk/StartUp.lua")
  130.        
  131.         Monitor[0].clear()
  132.        
  133.         Logo.drawLogo(Monitor[0], "Head", math.floor(w/2)-6, math.floor(h/2)-4)
  134.  
  135.         Monitor[0].setCursorPos(1, (h-1))
  136.         Monitor[0].clearLine()
  137.  
  138.         Functions.SetColors(Monitor[0], colors.white, colors.black)
  139.  
  140.         Monitor[0].setCursorPos(math.floor((w - string.len(" Done ! ")) /2), (h-1))
  141.  
  142.         print(" Done ! ")
  143.  
  144.         Functions.SetColors(Monitor[0], colors.black, colors.white)
  145.        
  146.     else
  147.        
  148.         Monitor[0].setCursorPos(1, (h-1))
  149.         Monitor[0].clearLine()
  150.  
  151.         Functions.SetColors(Monitor[0], colors.red, colors.black)
  152.  
  153.         Monitor[0].setCursorPos(math.floor((w - string.len(" No disk found !!! ")) /2), (h-1))
  154.  
  155.         print(" No disk found !!! ")
  156.  
  157.         Functions.SetColors(Monitor[0], colors.black, colors.white)
  158.        
  159.         error()
  160.        
  161.     end
  162.    
  163. else
  164.    
  165.     Monitor[0].setCursorPos(1, (h-1))
  166.     Monitor[0].clearLine()
  167.  
  168.     Functions.SetColors(Monitor[0], colors.red, colors.black)
  169.  
  170.     Monitor[0].setCursorPos(math.floor((w - string.len(" No disk drive found !!! ")) /2), (h-1))
  171.  
  172.     print(" No disk drive found !!! ")
  173.  
  174.     Functions.SetColors(Monitor[0], colors.black, colors.white)
  175.    
  176.     error()
  177.    
  178. end
  179.  
Advertisement
Add Comment
Please, Sign In to add comment