Advertisement
samuelask

Hiddengate Lab/bunker

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