Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Yeeet OS Main Script (startup.lua)
- -- Cat ASCII Art for Loading Screen
- local catArt = [[
- /\_/\
- ( o.o )
- > ^ <
- ]]
- -- Loading Screen Function
- local function loadingScreen()
- term.clear()
- term.setCursorPos(1, 1)
- print("===== Yeeet OS =====")
- print("")
- -- Print cat art on both sides
- local width, height = term.getSize()
- for line in string.gmatch(catArt, "[^\n]+") do
- term.setCursorPos(1, term.getCursorPos())
- print(line)
- term.setCursorPos(width - #line + 1, term.getCursorPos() - 1)
- print(line)
- end
- -- Print loading bar in the middle
- term.setCursorPos(1, height)
- print("Loading...")
- for i = 1, 20 do
- sleep(0.2) -- Simulate slow loading
- write("=")
- end
- sleep(1) -- Brief pause before proceeding
- term.clear()
- end
- -- Admin Login Function
- local function loginScreen()
- print("Welcome to Yeeet OS!")
- print("Admin Login Required:")
- write("Username: ")
- local username = read()
- write("Password: ")
- local password = read("*") -- Masks password input
- if username == "admin" and password == "Loveycat0!" then
- print("Login successful!")
- homeScreen() -- Navigate to home screen after successful login
- else
- print("Invalid username or password. Shutting down.")
- sleep(2)
- os.shutdown()
- end
- end
- -- Home Screen Navigation
- local menuOptions = { "Open Drawing", "Open Programming", "Show Time", "Shutdown", "Uninstall OS" }
- local selectedIndex = 1
- local function drawMenu()
- term.clear()
- term.setCursorPos(1, 1)
- print("===== Yeeet OS =====")
- print("Use Arrow Keys to Navigate and Enter to Select")
- for i, option in ipairs(menuOptions) do
- if i == selectedIndex then
- print("-> " .. option)
- else
- print(" " .. option)
- end
- end
- end
- local function homeScreen()
- while true do
- drawMenu()
- local event, key = os.pullEvent("key")
- if key == keys.up then
- selectedIndex = selectedIndex - 1
- if selectedIndex < 1 then
- selectedIndex = #menuOptions
- end
- elseif key == keys.down then
- selectedIndex = selectedIndex + 1
- if selectedIndex > #menuOptions then
- selectedIndex = 1
- end
- elseif key == keys.enter then
- if menuOptions[selectedIndex] == "Open Drawing" then
- shell.run("draw.lua")
- elseif menuOptions[selectedIndex] == "Open Programming" then
- shell.run("programming.lua")
- elseif menuOptions[selectedIndex] == "Show Time" then
- term.clear()
- term.setCursorPos(1, 1)
- print("Current time: " .. textutils.formatTime(os.time(), true))
- print("\nPress any key to return.")
- os.pullEvent("key")
- elseif menuOptions[selectedIndex] == "Shutdown" then
- os.shutdown()
- elseif menuOptions[selectedIndex] == "Uninstall OS" then
- shell.run("uninstall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement