Advertisement
Marlingaming

Aperture Science OS System - Shutdown Prompt

Sep 16th, 2021 (edited)
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. --SHUTDOWN PROMPT
  3. --this program is called before a OS Shutsdown, and asks if the user really wants to shutdown, cancel shutdown, or instead reboot the OS
  4. --this program is for Minecraft 1.16.5, CC Tweaked
  5. local i = 15
  6.  
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. print("SHUTTING DOWN")
  10. print("press e to cancel, or r to instead reboot the OS")
  11. term.setCursorPos(2,5)
  12. os.startTimer(15)
  13. while true do
  14. sleep(3)
  15. term.write(i.." seconds until system shutsdown")
  16. if i > 1 then
  17. i = i - 1
  18. end
  19. local event, item = os.pullEvent()
  20. term.clearLine()
  21. if event == "timer" then
  22. break
  23. elseif event == "key" and item == keys.e then
  24. sleep(2)
  25. print("Canceling Shutdown, sending back to Menu")
  26. sleep(5)
  27. i = -1
  28. elseif event == "key" and item == keys.r then
  29. sleep(5)
  30. print("Rebooting in 5...")
  31. os.reboot()
  32. end
  33. end
  34. if i == -1 then
  35. shell.run(".ApertureOS_Base")
  36. elseif i >= 0 then
  37. print("Shutting Down Now...")
  38. sleep(5)
  39. os.shutdown()
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement