Advertisement
DOGGYWOOF

Untitled

Dec 18th, 2024 (edited)
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 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.  
  26. for _, fileName in ipairs(requiredFiles) do
  27. if not fs.exists(fileName) then
  28. table.insert(missingFiles, fileName)
  29. end
  30. end
  31.  
  32. return missingFiles
  33. end
  34.  
  35. -- Main function to execute no-os.lua if files are missing
  36. local function main()
  37. local missing = checkFiles()
  38.  
  39. if #missing > 0 then
  40. -- Execute no-os.lua if any files are missing
  41. shell.run("no-os")
  42. else
  43. -- All files exist, continue with your code here
  44. shell.run("/disk/boot/start-check.lua")
  45. -- Add your code to run if all files exist
  46. end
  47. end
  48.  
  49. -- Check for redstone signal at the very start
  50. if checkRedstoneSignal() then
  51. return -- Exit immediately if the emergency bootloader was executed
  52. end
  53.  
  54. -- Run the main function if no redstone signal was detected
  55. main()
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement