Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- --SHUTDOWN PROMPT
- --this program is called before a OS Shutsdown, and asks if the user really wants to shutdown, cancel shutdown, or instead reboot the OS
- --this program is for Minecraft 1.16.5, CC Tweaked
- local i = 15
- term.clear()
- term.setCursorPos(1,1)
- print("SHUTTING DOWN")
- print("press e to cancel, or r to instead reboot the OS")
- term.setCursorPos(2,5)
- os.startTimer(15)
- while true do
- sleep(3)
- term.write(i.." seconds until system shutsdown")
- if i > 1 then
- i = i - 1
- end
- local event, item = os.pullEvent()
- term.clearLine()
- if event == "timer" then
- break
- elseif event == "key" and item == keys.e then
- sleep(2)
- print("Canceling Shutdown, sending back to Menu")
- sleep(5)
- i = -1
- elseif event == "key" and item == keys.r then
- sleep(5)
- print("Rebooting in 5...")
- os.reboot()
- end
- end
- if i == -1 then
- shell.run(".ApertureOS_Base")
- elseif i >= 0 then
- print("Shutting Down Now...")
- sleep(5)
- os.shutdown()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement