Advertisement
samuelask

High cmd

Mar 31st, 2025
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.48 KB | None | 0 0
  1. -- Script for Bunker Control
  2. local component = require("component")
  3. local thread = require("thread")
  4. local event = require("event")
  5. local term = require("term")
  6. local serialization = require("serialization")
  7. local sides = require("sides")
  8. local colors = require("colors")
  9. local modem = component.modem
  10. local gpu = component.gpu
  11. local tunnel = component.tunnel
  12. local lastMessageId = nil
  13. user = ""
  14. Local_Name = "High Command"
  15. Short_Name = "[High cmd] "
  16. running = true
  17. decon = false
  18. -- Configuration
  19. beacon = true
  20. modem.open(123)
  21.  
  22. -- UI Drawing Function
  23. local function draw_ui()
  24.     term.clear()
  25.     print("Bunker Control")
  26.     print("[SPACE] Toggle Emergency Beacon [" .. (beacon and "ON" or "OFF") .. "]")
  27.     print("[D] " .. (decon and "Run Decontamination Procedure [RUNNING]" or "Run Decontamination Procedure"))
  28.     print("[U] Update orders from high command")
  29.     print("[M] Messages")
  30.     print("[Q] Dial Omega Site")
  31. end
  32.  
  33. -- UI Drawing Function messages
  34. local function draw_ui_messages()
  35.     term.clear()
  36.     print("Messages")
  37.     print("[R] Read messages")
  38.     print("[S] Send message")
  39.     print("[E] Exit")
  40. end
  41.  
  42. -- Function to send commands
  43. local function send_command(address, value, header)
  44.  
  45.   local data = {
  46.     from = Local_Name,
  47.     shrt = Short_Name,
  48.     user = user,
  49.     to = address,
  50.     header = header,
  51.     message = value,
  52.     timestamp = os.time()
  53.   }
  54.     local serialized_data = serialization.serialize(data)
  55.     modem.send(relay_address, 123, serialized_data)
  56. end
  57.  
  58. -- Function to read messages
  59. local function read_message()
  60.     ::continue1::
  61.     term.clear()
  62.     print("Inbox")
  63.     print("Pick a message to read")
  64.     print("︱NEWEST︱")
  65.     print("[1] ︱ [Omega] ComE ︱")
  66.     print("[2] ︱ [ALERT] LOCKDOWN INITIATED ︱")
  67.     print("[3] ︱ [Lab 1] Missing Shipment ︱")
  68.     print("[4] ︱ [Lab 2] Lab results ︱")
  69.     print("[5] ︱ [Omega] Iris installed ︱")
  70.     print("[6] ︱ [High cmd] Increased activity READ ME︱")
  71.     print("[7] ︱ [Lab 2] Eggsacks ︱")
  72.     print("︱OLDEST︱")
  73.     print("")
  74.     print("")
  75.     print("[E] Exit")
  76.     local answer = io.read()
  77.     if answer == "1" then
  78.         term.clear()
  79.         print("︱ [Omega] ComE ︱")
  80.         print("")
  81.         print("Join us, we lvie in hramony, the msnoetrs are gone, we cannot aecscc your wold,")
  82.         print("you will cmoe to ouesr, cmoe cmoe, Alvin missse you all")
  83.         print("")
  84.         print("Unknown entity, Omega Site")
  85.         print("")
  86.         print("")
  87.         print("[E] Exit")
  88.         local answer = io.read()
  89.         goto continue1
  90.     elseif answer == "2" then
  91.         term.clear()
  92.         print("︱ [ALERT] LOCKDOWN INITIATED ︱")
  93.         print("")
  94.         print("THIS IS NOT A DRILL, THIS IS NOT A DRILL, THIS IS NOT A DRILL")
  95.         print("ALL SITES, COMMENCE Decontamination Procedure, COMMENCE LOCKDOWN.")
  96.         print("READ REST OF MESSAGE WHEN COMPLETE!")
  97.         print("")
  98.         print("Omega site is unavailable, no one is answering. Lab 2 is the same.")
  99.         print("Alpha site received a wormhole from Omega site but no one got through!.")
  100.         print("We cannot reach them since High Command is also unavailable.")
  101.         print("I have ordered an ALERT on all channels as proper procedure.")
  102.         print("PLEASE RESPOND IF YOU ARE READING THIS!.")
  103.         print("We also have a power problem at Alpha site, today we were supposed to receive a new ZPM.")
  104.         print("At limited usage we should be good for another month, but after that we need to evacuate.")
  105.         print("Since High Command is not available we cannot use our stargate, the Iris code is encrypted.")
  106.         print("RESPOND IMMEDIATELY if receiving this message!.")
  107.         print("")
  108.         print("Rosewood, Head of Security, Alpha Site")
  109.         print("")
  110.         print("")
  111.         print("[E] Exit")      
  112.         local answer = io.read()
  113.         goto continue1
  114.     elseif answer == "3" then
  115.         term.clear()
  116.         print("︱ [Lab 1] Missing Shipment ︱")
  117.         print("")
  118.         print("Im reaching you since i cant get a hold of Lab 2 myself, my security clearence isnt that high.")
  119.         print("We were supposed to receive a shipment today but it never came. It was supposed to be delivered through the gate.")
  120.         print("It does not say what it even is, so you can imagine my frustration.")
  121.         print("Let me know if you find it, i will report this incident to my higher ups, you should report it to High Command.")
  122.         print("")
  123.         print("Jack, Shipment officer, Lab 1")
  124.         print("")
  125.         print("")
  126.         print("[E] Exit")
  127.         local answer = io.read()
  128.         goto continue1
  129.     elseif answer == "4" then
  130.         term.clear()
  131.         print("︱ [Lab 2] Lab results ︱")
  132.         print("")
  133.         print("We have dubbed it Alvin, from alvin and the chipmunks!")
  134.         print("Alvin has exceeded our expectations, he (or it rather) is a perfect creature. Able to adapt and reform his body at will.")
  135.         print("We have feeded it live chipmunks and it immediately assumed its form as one! Before devouring them.")
  136.         print("It has now grown, its the size of a human. Although i doubt it has the intelligence of one.")
  137.         print("It also has this weird effect on life around it, it kinda dies, and reanimates into something different.")
  138.         print("We had to increase the security zone around its holding area, my plants were dying because of it.")
  139.         print("We will need to move it in the near future, to a more secure facility.")
  140.         print("I hear Lab 1 is getting a 20 billion dollar funding this year, lucky them.")
  141.         print("Let High Command know i will be terminating the rest of the eggs also, they have begun to smell.")
  142.         print("Oh and that Lab 1 can take care of Alvin.")
  143.         print("")
  144.         print("Doctor Greywall, Lab 2")
  145.         print("")
  146.         print("")
  147.         print("[E] Exit")      
  148.         local answer = io.read()
  149.         goto continue1
  150.     elseif answer == "5" then
  151.         term.clear()
  152.         print("︱ [Omega] Iris installed ︱")
  153.         print("")
  154.         print("As per requested the Iris is now operational, although we are abit sceptical that the code is classified.")
  155.         print("What if the settlers have family to visit?")
  156.         print("Also it will become harder to receive supply, High command needs to approve everytime so they can shutdown the Iris!")
  157.         print("Please forward these issues to High Command, its important for us.")
  158.         print("We have also been seeing thing here, things in the dark. Im not the only one.")
  159.         print("David saw a GIANT spider yesterday, looked like it could eat a cat!.")
  160.         print("")
  161.         print("Bryan Haddoc, Omega Site")  
  162.         print("")
  163.         print("")
  164.         print("[E] Exit")
  165.         local answer = io.read()
  166.         goto continue1
  167.     elseif answer == "6" then
  168.         term.clear()
  169.         print("︱ [High cmd] Increased activity READ ME︱")
  170.         print("")
  171.         print("High Command has finished its assessment around the Omega site, new security measures are to be taken.")
  172.         print("The local fauna has been increasing its hostility towards the site, where as before it was only curious of us, it is now our belief it has grown more hostile.")
  173.         print("No doubt due to the experiments from Doctor Greywall in Lab 2.")
  174.         print("An Iris to the gate at Omega site is to be installed at once! New intel suggests that there is currently a large scale operation")
  175.         print("underway intended to sabotage the site, possibly even a takeover. Secure the gate, then take care of the wildlife surrounding the Omega site.")
  176.         print("We dont want any surprises. Make sure that the Iris gate code is ONLY known by High Command.")
  177.         print("")
  178.         print("The settlements beyond Omega is also now at greater risk.")
  179.         print("Until we have a greater understanding of the local fauna, NO personnel is allowed to leave the Omega site.")
  180.         print("The settlers can protect themselves, they are all armed after all.")
  181.         print("")
  182.         print("Secretary General Coldwell, HC")
  183.         print("")
  184.         print("")
  185.         print("[E] Exit")      
  186.         local answer = io.read()
  187.         goto continue1
  188.     elseif answer == "7" then
  189.         term.clear()
  190.         print("︱ [Lab 2] Eggsacks ︱")
  191.         print("")
  192.         print("The eggsacks found on the planet nibiru have produced results.")
  193.         print("We have managed to create a hybrid of a vein floater along with local fauna found on the Omega site.")
  194.         print("So far it has adapted to everything we have thrown at it,")
  195.         print("Lava, shotguns, electrocutions, it seems to handle it all.")
  196.         print("The staff is beginning to wonder what we should do if it breaks out.")
  197.         print("Not to worry, the lab is set to blow with a 100 Megaton warhead if it does, but i wont tell them that.")
  198.         print("Also it has begun laying eggs on its own, expect more results sooner now rather than later.")
  199.         print("")
  200.         print("Doctor Greywall, Lab 2")
  201.         print("")
  202.         print("")
  203.         print("[E] Exit")  
  204.         local answer = io.read()
  205.         goto continue1
  206.     elseif answer == "e" or answer == "E" then
  207.    
  208.     else
  209.         goto continue1
  210.     end
  211. end
  212.  
  213. -- Function to send messages
  214. local function send_message()
  215.     ::continue1::
  216.     term.clear()
  217.     print("Pick receiver")
  218.     print("[1] Epsilon Site")
  219.     print("[2] Laboratory 1")
  220.     print("[3] Laboratory 2")
  221.     print("[4] Omega Site")
  222.     print("[E] Exit")
  223.     local answer = io.read()
  224.     if answer == "1" then
  225.         send_to = "Epsilon Site"
  226.         print("Epsilon Site Confirmed, please type the subject of your message and press enter")
  227.         print("")
  228.         local header = io.read()
  229.         term.clear()
  230.         print("Subject: " .. header)
  231.         print("")
  232.         print("Please type your message")
  233.         print("")
  234.         local message = io.read()
  235.         term.clear()
  236.         print("From: " .. Local_Name)
  237.         print("Subject: " .. header)
  238.         print("Message: " .. message)
  239.         print("")
  240.         print("Do you want to send this message to ".. send_to"?")
  241.         print("Y/n")
  242.         local answer = io.read()
  243.         if answer == "Y" or answer == "y" then
  244.             send_command(send_to, message, header)
  245.         end
  246.         term.clear()
  247.         goto continue1
  248.     elseif answer == "2" then
  249.         send_to = "Laboratory 1"
  250.         term.clear()
  251.         print("Laboratory 1 Confirmed, please type the subject of your message and press enter")
  252.         print("")
  253.         local header = io.read()
  254.         term.clear()
  255.         print("Subject: " .. header)
  256.         print("")
  257.         print("Please type your message")
  258.         print("")
  259.         local message = io.read()
  260.         term.clear()
  261.         print("From: " .. Local_Name)
  262.         print("Subject: " .. header)
  263.         print("Message: " .. message)
  264.         print("")
  265.         print("Do you want to send this message to ".. send_to"?")
  266.         print("Y/n")
  267.         local answer = io.read()
  268.         if answer == "Y" or answer == "y" then
  269.             send_command(send_to, message, header)
  270.         end
  271.         term.clear()
  272.         goto continue1
  273.     elseif answer == "3" then
  274.         send_to = "Laboratory 2"
  275.         term.clear()
  276.         print("Laboratory 2 Confirmed, please type the subject of your message and press enter")
  277.         print("")
  278.         local header = io.read()
  279.         term.clear()
  280.         print("Subject: " .. header)
  281.         print("")
  282.         print("Please type your message")
  283.         print("")
  284.         local message = io.read()
  285.         term.clear()
  286.         print("From: " .. Local_Name)
  287.         print("Subject: " .. header)
  288.         print("Message: " .. message)
  289.         print("")
  290.         print("Do you want to send this message to ".. send_to"?")
  291.         print("Y/n")
  292.         local answer = io.read()
  293.         if answer == "Y" or answer == "y" then
  294.             send_command(send_to, message, header)
  295.         end
  296.         term.clear()
  297.         goto continue1
  298.     elseif answer == "4" then
  299.         send_to = "Omega Site"
  300.         term.clear()
  301.         print("Omega Site Confirmed, please type the subject of your message and press enter.")
  302.         print("")
  303.         local header = io.read()
  304.         term.clear()
  305.         print("Subject: " .. header)
  306.         print("")
  307.         print("Please type your message")
  308.         print("")
  309.         local message = io.read()
  310.         term.clear()
  311.         print("From: " .. Local_Name)
  312.         print("Subject: " .. header)
  313.         print("Message: " .. message)
  314.         print("")
  315.         print("Do you want to send this message to ".. send_to"?")
  316.         print("Y/n")
  317.         local answer = io.read()
  318.         if answer == "Y" or answer == "y" then
  319.             send_command(send_to, message, header)
  320.         end
  321.         term.clear()
  322.         goto continue1
  323.     elseif answer == "e" or answer == "E" then
  324.    
  325.     else
  326.         goto continue1
  327.     end
  328. end
  329. local function handle_modem_message(_, _, from, port, _, message, data)
  330.     if port == 123 or port == 0 then
  331.         if message == "error" then
  332.             print("")
  333.             print("[ERROR] " .. data)
  334.         elseif message == "sent_message" then
  335.             print("Sent message to " .. data)
  336.         elseif message == "new_message" then
  337.             local message_data = serialization.unserialize(data)
  338.             if message_data.timestamp ~= lastMessageId then
  339.                 lastMessageId = message_data.timestamp
  340.                 print("")
  341.                 print("New message received from " .. message_data.from)
  342.                 print("Subject: " .. message_data.shrt .. message_data.header)
  343.                 print("Message: " .. message_data.message)
  344.                 print("User: " .. message_data.user)
  345.             end
  346.         end
  347.     end
  348. end
  349. -- Keyboard Input Listener
  350. local function key_listener(_, _, char, code, playerName)
  351.     local key = string.char(char)
  352.     user = playerName
  353.     event.ignore("key_down", key_listener)
  354.     if key == "u" then
  355.             term.clear()
  356.             print("Connecting to central network...")
  357.             os.sleep(3)
  358.             print("[ERROR] No connection")
  359.             os.sleep(0.5)
  360.             print("[ERROR] Diagnosing...")
  361.             os.sleep(3)
  362.             print("[ERROR] Receiver [OFFLINE]")
  363.             print("[✔] Transmitter [ONLINE]")
  364.             print("[⚠] Can not receive orders/messages")
  365.             print("[⚠] ONLY Transmit!")
  366.             print("")
  367.             print("Please follow standard Emergency Procedures")
  368.             os.sleep(8)
  369.             draw_ui()
  370.     elseif key == "d" then
  371.             if decon then
  372.                 print("Cannot stop Decontamination Procedure")
  373.             elseif not decon then
  374.                 decon = not decon
  375.                 draw_ui()
  376.                 debug_card.runCommand("/effect @e[x=15019,y=40,z=12603,dx=57,dy=13,dz=57] minecraft:poison 10 3")
  377.                 os.sleep(10)
  378.                 decon = not decon
  379.                 draw_ui()
  380.                 print("Decontamination Procedure Complete!")
  381.             end
  382.     elseif key == "q" then
  383.             reds.setBundledOutput(sides.bottom, colors.black, 255)
  384.             draw_ui()
  385.             print("")
  386.             print("Dialing Omega Site!")
  387.             os.sleep(2)
  388.             reds.setBundledOutput(sides.bottom, colors.black, 0)
  389.     elseif code == 57 then
  390.         if beacon then
  391.             print("Confirm Beacon Shutdown")
  392.             print("Y/n")
  393.             local answer = io.read()
  394.             if answer == "y" or answer == "Y" then
  395.                 beacon = not beacon
  396.                 print("Confirmed")
  397.                 os.sleep(3)
  398.                 draw_ui()
  399.             else
  400.                 print("Aborted!")
  401.                 os.sleep(3)
  402.                 draw_ui()
  403.             end
  404.         elseif not beacon then
  405.             beacon = not beacon
  406.             draw_ui()
  407.             print("Emergency Beacon Online!")
  408.            
  409.         end
  410.     elseif key == "m" then
  411.         ::continue::
  412.         draw_ui_messages()
  413.         local answer = io.read()
  414.         if answer == "r" or answer == "R" then
  415.             read_message()
  416.             goto continue
  417.         elseif answer == "s" or answer == "S" then
  418.             send_message()
  419.             goto continue
  420.         elseif answer == "e" or answer == "E" then
  421.             draw_ui()
  422.         else
  423.             goto continue
  424.         end
  425.     end
  426.     event.listen("key_down", key_listener)
  427. end
  428. draw_ui()
  429. messages = event.listen("modem_message", handle_modem_message)
  430. event.listen("key_down", key_listener)
  431.  
  432. while running do
  433.     os.sleep(0.5)
  434. end
  435.  
  436. os.sleep(1)
  437. os.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement