Advertisement
yeeeeeeeeeeeee

test 2

Mar 20th, 2025
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.14 KB | None | 0 0
  1. -- Yeeet OS Main Script (startup.lua)
  2.  
  3. -- Cat ASCII Art for Loading Screen
  4. local catArt = [[
  5.  /\_/\  
  6. ( o.o )
  7.  > ^ <
  8. ]]
  9.  
  10. -- Loading Screen Function
  11. local function loadingScreen()
  12.     term.clear()
  13.     term.setCursorPos(1, 1)
  14.     print("===== Yeeet OS =====")
  15.     print("")
  16.  
  17.     -- Print cat art on both sides
  18.     local width, height = term.getSize()
  19.     for line in string.gmatch(catArt, "[^\n]+") do
  20.         term.setCursorPos(1, term.getCursorPos())
  21.         print(line)
  22.         term.setCursorPos(width - #line + 1, term.getCursorPos() - 1)
  23.         print(line)
  24.     end
  25.  
  26.     -- Print loading bar in the middle
  27.     term.setCursorPos(1, height)
  28.     print("Loading...")
  29.     for i = 1, 20 do
  30.         sleep(0.2) -- Simulate slow loading
  31.         write("=")
  32.     end
  33.     sleep(1) -- Brief pause before proceeding
  34.     term.clear()
  35. end
  36.  
  37. -- Admin Login Function
  38. local function loginScreen()
  39.     print("Welcome to Yeeet OS!")
  40.     print("Admin Login Required:")
  41.     write("Username: ")
  42.     local username = read()
  43.     write("Password: ")
  44.     local password = read("*") -- Masks password input
  45.  
  46.     if username == "admin" and password == "Loveycat0!" then
  47.         print("Login successful!")
  48.         homeScreen() -- Navigate to home screen after successful login
  49.     else
  50.         print("Invalid username or password. Shutting down.")
  51.         sleep(2)
  52.         os.shutdown()
  53.     end
  54. end
  55.  
  56. -- Home Screen Navigation
  57. local menuOptions = { "Open Drawing", "Open Programming", "Show Time", "Shutdown", "Uninstall OS" }
  58. local selectedIndex = 1
  59.  
  60. local function drawMenu()
  61.     term.clear()
  62.     term.setCursorPos(1, 1)
  63.     print("===== Yeeet OS =====")
  64.     print("Use Arrow Keys to Navigate and Enter to Select")
  65.  
  66.     for i, option in ipairs(menuOptions) do
  67.         if i == selectedIndex then
  68.             print("-> " .. option)
  69.         else
  70.             print("   " .. option)
  71.         end
  72.     end
  73. end
  74.  
  75. local function homeScreen()
  76.     while true do
  77.         drawMenu()
  78.         local event, key = os.pullEvent("key")
  79.  
  80.         if key == keys.up then
  81.             selectedIndex = selectedIndex - 1
  82.             if selectedIndex < 1 then
  83.                 selectedIndex = #menuOptions
  84.             end
  85.         elseif key == keys.down then
  86.             selectedIndex = selectedIndex + 1
  87.             if selectedIndex > #menuOptions then
  88.                 selectedIndex = 1
  89.             end
  90.         elseif key == keys.enter then
  91.             if menuOptions[selectedIndex] == "Open Drawing" then
  92.                 shell.run("draw.lua")
  93.             elseif menuOptions[selectedIndex] == "Open Programming" then
  94.                 shell.run("programming.lua")
  95.             elseif menuOptions[selectedIndex] == "Show Time" then
  96.                 term.clear()
  97.                 term.setCursorPos(1, 1)
  98.                 print("Current time: " .. textutils.formatTime(os.time(), true))
  99.                 print("\nPress any key to return.")
  100.                 os.pullEvent("key")
  101.             elseif menuOptions[selectedIndex] == "Shutdown" then
  102.                 os.shutdown()
  103.             elseif menuOptions[selectedIndex] == "Uninstall OS" then
  104.                 shell.run("uninstall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement