burnin_aura

[CC] [MAINFRAME]

May 29th, 2016
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[ICBM Launch Server]]--
  2.  
  3. size = {term.getSize()}
  4.  
  5. users = {"Andrew2070"}
  6. passwords = {"3765"}
  7.  
  8. --[[Functions]]--
  9.  
  10. local function findSilos()
  11.     rednet.broadcast("ping silo")
  12.  
  13.   local timerID = os.startTimer(waitDelay)
  14.  
  15.   while true do
  16.     event, id, msg, distance = os.pullEvent()
  17.    
  18.     if event == "rednet_message" and msg == "pong" then
  19.       table.insert(silos, id)
  20.       timerID = os.startTimer(waitDelay)
  21.     elseif event == "timer" and id == timerID then
  22.        return
  23.     end
  24.   end
  25. end
  26.  
  27. local curSilo = 1
  28. local function launch(count, x, y, z)
  29.   local msg = {x = x, y = y, z = z}
  30.     print("launching Missiles At " .. x .. ", " .. y .. ", " .. z)
  31.       for i = 1, count do
  32.         rednet.send(silos[curSilo], msg)
  33.           curSilo = (curSilo == #silos) and 1 or (curSilo + 1)
  34.             sleep(5)
  35.       end
  36. end
  37.  
  38. local function printSilos()
  39.   clear()
  40. red()
  41.     print("        [Detected silos]       ")
  42.     for k, v in ipairs(silos) do
  43.     print("        silo #" .. k .. " id = "..v)
  44.   end
  45. red()
  46. end
  47.  
  48. function drawBoxPos(x,y,x1,y1)
  49.   cy = y
  50.   term.setCursorPos(x,y)
  51.   for i = 1,(y1-y)+1 do
  52.     for i = 1,(x1-x) do
  53.       term.write(" ")
  54.     end
  55.     cy = cy+1
  56.     term.setCursorPos(x,cy)
  57.   end
  58. end
  59.  
  60. function reset()
  61.   term.setBackgroundColor(colors.lightGray)
  62.   term.setCursorPos(2,12)
  63.   for i = 1,size[1]-4 do
  64.     term.write(" ")
  65.   end
  66.   term.setTextColor(colors.gray)
  67.   term.setBackgroundColor(colors.gray)
  68.   drawBoxPos(9,8,size[1]-1,8)
  69.   term.setBackgroundColor(colors.lightGray)
  70.   term.setCursorPos(3,8)
  71.   print("USER:")
  72.   term.setBackgroundColor(colors.gray)
  73.   drawBoxPos(9,10,size[1]-1,10)
  74.   term.setBackgroundColor(colors.lightGray)
  75.   term.setCursorPos(3,10)
  76.   print("PASS:")
  77. end
  78.  
  79. function loginScreen()
  80.   term.setBackgroundColor(colors.white)
  81.   term.clear()
  82.   term.setBackgroundColor(colors.lightGray)
  83.   drawBoxPos(2,2,size[1],size[2]-1)
  84.   term.setCursorPos(1,size[2]-7)
  85.   term.setBackgroundColor(colors.gray)
  86.   drawBoxPos(((size[1]/2)-10)-1,2,((size[1]/2)+13)-1,4)
  87.   term.setBackgroundColor(colors.red)
  88.   drawBoxPos((size[1]/2)-10,1,(size[1]/2)+13,3)
  89.   term.setTextColor(colors.gray)
  90.   str = "Skynet Control Panel"
  91.   term.setCursorPos((size[1]/2)-(#str/2) +1,2)
  92.   term.write(str)
  93.   term.setBackgroundColor(colors.lightGray)
  94.   str = "User Account Information"
  95.   term.setCursorPos((size[1]/2)-(#str/2) +1,6)
  96.   term.write(str)
  97.   term.setBackgroundColor(colors.gray)
  98.   drawBoxPos(9,8,size[1]-1,8)
  99.   term.setBackgroundColor(colors.lightGray)
  100.   term.setCursorPos(3,8)
  101.   print("USER:")
  102.   term.setBackgroundColor(colors.gray)
  103.   drawBoxPos(9,10,size[1]-1,10)
  104.   term.setBackgroundColor(colors.lightGray)
  105.   term.setCursorPos(3,10)
  106.   print("PASS:")
  107.   term.setBackgroundColor(colors.red)
  108.   drawBoxPos(((size[1]/2)-9)-1,13,((size[1]/2)+13)-1,15)
  109.   term.setTextColor(colors.gray)
  110.   str = "Login to Skynet!"
  111.   term.setCursorPos((size[1]/2)-(#str/2) +1,14)
  112.   term.write(str)
  113.   term.setBackgroundColor(colors.lightGray)
  114.   str = "(c) 2016 Skynet - Build. Innovate. Conquer"
  115.   term.setCursorPos((size[1]/2)-(#str/2) +1,size[2]-2)
  116.   term.write(str)
  117.   while true do
  118.     evnt = {os.pullEvent()}
  119.     if evnt[1] == "mouse_click" then
  120.       if evnt[3] > 8 and evnt[3] < size[1]-1 and evnt[4] == 8 then
  121.         term.setBackgroundColor(colors.gray)
  122.         term.setTextColor(colors.lightGray)
  123.         term.setCursorPos(9,8)
  124.         username = read()
  125.       elseif evnt[3] > 8 and evnt[3] < size[1]-1 and evnt[4] == 10 then
  126.         term.setBackgroundColor(colors.gray)
  127.         term.setTextColor(colors.lightGray)
  128.         term.setCursorPos(9,10)
  129.         password = read("*")
  130.       elseif evnt[3] > ((size[1]/2)-9)-2 and evnt[3] < ((size[1]/2)+13)-2 and evnt[4] > 12 and evnt[4] < 16 then
  131.         if username ~= nil and password ~= nil then
  132.           loggedin = false
  133.           for i = 1,#users do
  134.             if username == users[i] then
  135.               if password == passwords[i] then
  136.                 term.setTextColor(colors.lime)
  137.                 term.setBackgroundColor(colors.lightGray)
  138.                 str = "Access Granted. Welcome back, "..username
  139.                 term.setCursorPos((size[1]/2)-(#str/2) +1,12)
  140.                 term.write(str)
  141.                 loggedin = true
  142.                 sleep(3)
  143.               end
  144.             end
  145.           end
  146.           if loggedin then
  147.  
  148. findSilos()
  149.  while true do
  150.   printSilos()
  151.   print("     [Launch Verification]     ")
  152.   print("    Enter Verification Code:")
  153.   write("     Code: ")
  154.   input  = read("*")
  155.   term.setBackgroundColor(colors.blue)
  156.   if input == "exit" then
  157.    break
  158.     elseif input == "949-854-3444" then
  159.      while true do
  160.      sleep(1)
  161.       print("  Enter Confirmation [Yes/No]  ")
  162.        write("Launch Confirmation: ")
  163.         input2 = read()
  164.        if input == "No" then
  165.       os.reboot()
  166.    elseif input2 == "Yes" then
  167.  local count, x, y, z
  168.   while not (type(count) == "number" and type(x) == "number" and type(y) == "number" and type(z) == "number") do
  169.       print("      [Target Selection]       ")
  170.       write(" Missile Count: ")
  171.       count = tonumber(read())
  172.       print("Coordinates:")
  173.       write("X: ")
  174.       x = tonumber(read())
  175.       write("Y: ")
  176.       y = tonumber(read())
  177.       write("Z: ")
  178.       z = tonumber(read())
  179.  
  180.    print("Launching at: "..x..","..y..","..z)
  181.    print("T-Minus 10 Seconds to Launch.")
  182.    sleep(1)
  183.    print("9 Seconds to Launch")
  184. print("8 Seconds to Launch")
  185. sleep(1)
  186. print("7 Seconds to Launch")
  187. sleep(1)
  188. print("6 Seconds to Launch")
  189. sleep(1)
  190. print("5 Seconds to Launch")
  191. sleep(1)
  192. print("4 Seconds to Launch")
  193. sleep(1)
  194. print("3 Seconds to Launch")
  195. sleep(1)
  196. print("2 Seconds to Launch")
  197. sleep(1)
  198. print("1 Seconds to Launch")
  199. sleep(1)
  200. print("Do You Wish to Abort Launch?")
  201. write("Abort? ")
  202. local abort = read()
  203. if abort == "Yes" then
  204. os.reboot()
  205. elseif abort == "No" then
  206.     end
  207.     launch(count, x, y, z)
  208.     sleep(10)
  209.     os.reboot()
  210.  
  211.           elseif loggedin == false then
  212.             term.setTextColor(colors.red)
  213.             term.setBackgroundColor(colors.lightGray)
  214.             str = "Username or Password incorrect."
  215.             term.setCursorPos((size[1]/2)-(#str/2) +1,12)
  216.             term.write(str)
  217.             sleep(2)
  218.             reset()
  219.           end
  220.         elseif username == nil or password == nil then
  221.           reset()
  222.           term.setTextColor(colors.red)
  223.           term.setBackgroundColor(colors.lightGray)
  224.           str = "Username or Password not recognized."
  225.           term.setCursorPos((size[1]/2)-(#str/2) +1,12)
  226.           term.write(str)
  227.           sleep(2)
  228.           reset()
  229.         end
  230.       end
  231.     end
  232.   end
  233. end
  234. end
  235. end
  236. end
  237. end
  238.  
  239. loginScreen()
  240. term.setBackgroundColor(colors.black)
  241. term.clear()
  242. term.setCursorPos(1,1)
Add Comment
Please, Sign In to add comment