yeeeeeeeeeeeee

test 5

Mar 20th, 2025
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.20 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. -- Profile Handling Functions
  11. local function saveProfile(username)
  12. local file = fs.open("profile.txt", "w")
  13. file.write(username)
  14. file.close()
  15. end
  16.  
  17. local function loadProfile()
  18. if fs.exists("profile.txt") then
  19. local file = fs.open("profile.txt", "r")
  20. local username = file.readAll()
  21. file.close()
  22. return username
  23. else
  24. return nil
  25. end
  26. end
  27.  
  28. -- Loading Screen Function
  29. local function loadingScreen()
  30. term.clear()
  31. term.setCursorPos(1, 1)
  32. print("===== Yeeet OS =====")
  33. print("")
  34.  
  35. -- Print cat art on both sides
  36. local width, height = term.getSize()
  37. for line in string.gmatch(catArt, "[^\n]+") do
  38. term.setCursorPos(1, term.getCursorPos())
  39. print(line)
  40. term.setCursorPos(width - #line + 1, term.getCursorPos() - 1)
  41. print(line)
  42. end
  43.  
  44. -- Print loading bar in the middle
  45. term.setCursorPos(1, height)
  46. print("Loading...")
  47. for i = 1, 20 do
  48. sleep(0.2) -- Simulate slow loading
  49. write("=")
  50. end
  51. sleep(1) -- Brief pause before proceeding
  52. term.clear()
  53. end
  54.  
  55. -- First-Time Sign-In Screen
  56. local function firstSignIn()
  57. print("Welcome to Yeeet OS!")
  58. print("It seems like you're a new user.")
  59. write("Please enter your new username: ")
  60. local username = read()
  61. saveProfile(username) -- Save the new username
  62. print("Hello, " .. username .. "! Your profile has been created.")
  63. sleep(2)
  64. end
  65.  
  66. -- Admin Login Function
  67. local function loginScreen()
  68. term.clear()
  69. print("Welcome back to Yeeet OS!")
  70. print("Admin Login Required:")
  71. write("Username: ")
  72. local username = read()
  73. write("Password: ")
  74. local password = read("*") -- Masks password input
  75.  
  76. if username == "admin" and password == "Loveycat0!" then
  77. print("Login successful!")
  78. sleep(1)
  79. homeScreen() -- Navigate to home screen after successful login
  80. else
  81. print("Invalid username or password. Shutting down.")
  82. sleep(2)
  83. os.shutdown()
  84. end
  85. end
  86.  
  87. -- Home Screen Navigation
  88. local menuOptions = { "Open Drawing", "Open Programming", "Show Time", "Shutdown", "Uninstall OS" }
  89. local selectedIndex = 1
  90.  
  91. local function drawMenu()
  92. term.clear()
  93. term.setCursorPos(1, 1)
  94. print("===== Yeeet OS =====")
  95. print("Use Arrow Keys to Navigate and Enter to Select")
  96.  
  97. for i, option in ipairs(menuOptions) do
  98. if i == selectedIndex then
  99. print("-> " .. option)
  100. else
  101. print(" " .. option)
  102. end
  103. end
  104. end
  105.  
  106. -- Home Screen Logic
  107. local function homeScreen()
  108. while true do
  109. drawMenu()
  110. local event, key = os.pullEvent("key")
  111.  
  112. if key == keys.up then
  113. selectedIndex = selectedIndex - 1
  114. if selectedIndex < 1 then
  115. selectedIndex = #menuOptions
  116. end
  117. elseif key == keys.down then
  118. selectedIndex = selectedIndex + 1
  119. if selectedIndex > #menuOptions then
  120. selectedIndex = 1
  121. end
  122. elseif key == keys.enter then
  123. if menuOptions[selectedIndex] == "Open Drawing" then
  124. shell.run("draw.lua")
  125. elseif menuOptions[selectedIndex] == "Open Programming" then
  126. shell.run("programming.lua")
  127. elseif menuOptions[selectedIndex] == "Show Time" then
  128. term.clear()
  129. term.setCursorPos(1, 1)
  130. print("Current time: " .. textutils.formatTime(os.time(), true))
  131. print("\nPress any key to return.")
  132. os.pullEvent("key")
  133. elseif menuOptions[selectedIndex] == "Shutdown" then
  134. os.shutdown()
  135. elseif menuOptions[selectedIndex] == "Uninstall OS" then
  136. shell.run("uninstall.lua")
  137. end
  138. end
  139. end
  140. end
  141.  
  142. -- Main Execution Logic
  143. loadingScreen()
  144. local username = loadProfile()
  145. if not username then
  146. firstSignIn() -- Run the first-time sign-in screen if no profile exists
  147. end
  148. loginScreen()
  149.  
Add Comment
Please, Sign In to add comment