Advertisement
DOGGYWOOF

Untitled

Feb 3rd, 2025 (edited)
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. -- Function to handle redstone signal at the start
  2. local function checkRedstoneSignal()
  3. if redstone.getInput("right") then
  4. shell.run(".emgrec/bootloader")
  5. return true -- Indicates that the emergency bootloader was executed
  6. end
  7. return false -- Indicates no signal was detected
  8. end
  9.  
  10. -- List of required files
  11. local requiredFiles = {
  12. "/disk/bootloader/VA11-ILLA.lua",
  13. "/disk/os/home.lua",
  14. "/disk/os/lock.lua",
  15. "/disk/boot/boot-animation",
  16. "/disk/error/BSOD.lua",
  17. -- Add more file names as needed
  18. }
  19.  
  20. -- Function to check if all required files exist
  21. os.pullEvent = os.pullEventRaw
  22.  
  23. local function checkFiles()
  24. local missingFiles = {}
  25. print("
  26. [36m[INFO][0m Checking required files...
  27. ")
  28. sleep(1)
  29.  
  30. for _, fileName in ipairs(requiredFiles) do
  31. if fs.exists(fileName) then
  32. print("[32m[OK][0m " .. fileName)
  33. sleep(0.5)
  34. sleep(0.5)
  35. else
  36. print("[31m[MISSING][0m " .. fileName)
  37. sleep(0.5)
  38. sleep(0.5)
  39. table.insert(missingFiles, fileName)
  40. end
  41. end
  42.  
  43. return missingFiles
  44. end
  45.  
  46. -- Main function to execute no-os.lua if files are missing
  47. local function main()
  48. local missing = checkFiles()
  49.  
  50. if #missing > 0 then
  51. print("
  52. [31m[ERROR][0m Missing files detected! Running no-os.lua...
  53. ")
  54. sleep(1)
  55. sleep(1)
  56. shell.run("no-os")
  57. else
  58. print("
  59. [32m[SUCCESS][0m All required files are present! Proceeding with boot...
  60. ")
  61. sleep(1)
  62. sleep(1)
  63. shell.run("/disk/boot/boot-animation")
  64. -- Add your code to run if all files exist
  65. end
  66. end
  67.  
  68. -- Check for redstone signal at the very start
  69. if checkRedstoneSignal() then
  70. return -- Exit immediately if the emergency bootloader was executed
  71. end
  72.  
  73. -- Run the main function if no redstone signal was detected
  74. main()
  75.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement