Advertisement
nnimos

Untitled

May 6th, 2015
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. local locker = true
  2. local failed = true
  3. local attempted_login = true
  4. local password_server = 11
  5. securityDoor = false
  6. rednet.open("top")
  7. function Clear()
  8. term.clear()
  9. term.setCursorPos(1,1)
  10. end
  11. Clear()
  12. write("Loading... 0%")
  13. sleep(0.1)
  14. function MainScreen()
  15. attempted_login = false
  16. Clear()
  17. textutils.slowPrint("Milk Industries Nuclear Reactor Control.nAUTHORISED PERSONNEL ONLY!")
  18. print("")
  19. print("Please input the command you wish to perform.")
  20. print("")
  21. print("=================================")
  22. print("1. Login to Control Panaln2. Shutdown")
  23. print("=================================")
  24. while true do
  25. event, var=os.pullEvent("char")
  26. if var == ("1") then
  27. Login()
  28. elseif var ==("2") then
  29. Shutdown()
  30. end
  31. end
  32. end
  33. Clear()
  34. write("Loading... 4%")
  35. sleep(0.1)
  36. function Login()
  37. Clear()
  38. print("Please enter your username and password.n n")
  39. LoginInput()
  40. end
  41. function LoginInput()
  42. attempted_loging = true
  43. print("Username: ")
  44. username = read()
  45. print("Password: ")
  46. serpassword = read("*")
  47. rednet.send(password_server, username)
  48. senderId, message, distance = rednet.receive(3)
  49. if serpassword == message then
  50. failed = false
  51. locker = false
  52. Verified()
  53. else
  54. Failed()
  55. end
  56. end
  57. Clear()
  58. write("Loading... 28%")
  59. sleep(0.1)
  60. function Shutdown()
  61. Clear()
  62. textutils.slowPrint("Shutting down console...")
  63. sleep(1)
  64. os.shutdown()
  65. end
  66. Clear()
  67. write("Loading... 39%")
  68. sleep(0.1)
  69. function Failed()
  70. Clear()
  71. print("Incorrect login details, please try again.")
  72. print("")
  73. LoginInput()
  74. end
  75. Clear()
  76. write("Loading... 51%")
  77. sleep(0.1)
  78. function Verified()
  79. Clear()
  80. reactorLaunch = false
  81. write("Welcome! Please choose a command.nn")
  82. print("===================================")
  83. print("1. Security Management")
  84. if reactorLaunch == true then
  85. print("2. Disable Reactor Monitor")
  86. else
  87. print("2. Activate Reactor Monitor")
  88. end
  89. print("3. Reactor Controls")
  90. print("4. Log out")
  91. print("===================================")
  92. while true do
  93. event, var =os.pullEvent("char")
  94. if var == ("1") then
  95. Security()
  96. elseif var ==("2") and reactorLaunch then
  97. DisableMon()
  98. elseif var ==("2") then
  99. EnableMon()
  100. elseif var ==("3") then
  101. ReactorCtrl()
  102. elseif var ==("4") then
  103. Clear()
  104. textutils.slowPrint("Logging out...")
  105. sleep(2)
  106. Clear()
  107. os.reboot()
  108. end
  109. end
  110. end
  111. Clear()
  112. write("Loading... 72%")
  113. sleep(0.1)
  114. function Security()
  115. Clear()
  116. textutils.slowPrint("Security Menu. Please enter your command.")
  117. print("")
  118. print("===================================")
  119. if securityDoor == true then
  120. print("1. Close Reinforced Doors")
  121. elseif securityDoor == false then
  122. print("1. Open Reinforced Doors")
  123. end
  124. print("2. Main Menu")
  125. print("===================================n")
  126. while true do
  127. event, var =os.pullEvent("char")
  128. if var == ("1") and securityDoor == true then
  129. print("Warning! Closing Reinforced Doors!")
  130. rs.setOutput("back", false)
  131. sleep(2)
  132. securityDoor = false
  133. Security()
  134. elseif var == ("1") and securityDoor == false then
  135. print("Warning! Opening Reinforced Doors!")
  136. rs.setOutput("back", true)
  137. sleep(2)
  138. securityDoor = true
  139. Security()
  140. elseif var == ("2") then
  141. Verified()
  142. end
  143. end
  144. end
  145. Clear()
  146. write("Loading... 94%")
  147. sleep(0.1)
  148. Clear()
  149. write("Loading... 100%")
  150. sleep(1)
  151. while locker do
  152. MainScreen()
  153. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement