Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Components
- local component = require("component")
- local modem = component.modem
- local controller = component.inventory_controller
- local gpu = component.gpu
- -- Other Libraries
- local io = require("io")
- local event = require("event")
- local colours = require("colors")
- local os = require("os")
- -- port
- local sendPort = 6969
- -- The file to go to
- local arguments_as_a_table = {...}
- local gameFile = arguments_as_a_table[1]
- gpu.setResolution(40, 20)
- gpu.setForeground(colours.black, true)
- gpu.setBackground(colours.yellow, true)
- -- Ask to put in chest
- function awaitKeyInput ()
- while true do
- os.sleep(0.5)
- local block = controller.getStackInSlot(1,1)
- if block ~= nil then
- if block.name == "opencomputers:print" then
- break
- end
- end
- -- Display, awaiting input
- gpu.setForeground(colours.black, true)
- gpu.setBackground(colours.yellow, true)
- gpu.fill(1, 1, 40, 20, " ")
- gpu.set(10,10, "Insert Key Into Chest")
- end
- end
- -- Send Check
- function sendIdentificationPacket(address, port)
- local labelPacket = tostring(controller.getStackInSlot(1,1).label)
- print("\n Key Name: " .. labelPacket)
- modem.send(address, port, labelPacket)
- end
- -- Recieve Check
- function recieveIdentificationPacket()
- print("Waiting for response")
- modem.open(420)
- local _, _, _, _, _, message = event.pull("modem_message")
- if message == "Authorized" then
- gpu.setBackground(colours.green, true)
- gpu.fill(1, 1, 40, 20, " ")
- print("Success")
- else
- gpu.setForeground(colours.black, true)
- while true do
- gpu.setBackground(colours.red, true)
- gpu.fill(1, 1, 40, 20, " ")
- gpu.set(10,10, "Alert: Hacking attempted")
- os.sleep(1)
- gpu.setBackground(colours.yellow, true)
- gpu.fill(1, 1, 40, 20, " ")
- gpu.set(10,10,"Alert: Locking Computer")
- os.sleep(1)
- end
- end
- end
- awaitKeyInput()
- sendIdentificationPacket("003d7717-ce37-46f3-aea8-a7d247da4b48", sendPort)
- recieveIdentificationPacket()
- os.execute("mockGame.lua")
Add Comment
Please, Sign In to add comment