Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local POS_DIST = ({...})[1] -- Data persistence
- if POS_DIST then
- settings.set("DISTANCE_THRESHOLD", POS_DIST)
- settings.save(".settings")
- end
- ---
- do -- Installing sheepelibs due to dependancies
- if fs.exists("sheepelibs") then
- for _, api in pairs(fs.list("sheepelibs")) do
- local name = api:match("(%w+)%.lua")
- if name then
- os.unloadAPI("sheepelibs/"..api)
- end
- end
- fs.delete("sheepelibs")
- fs.delete("sheepelibs.lua")
- os.reboot()
- end
- local con = http.get("https://pastebin.com/raw/X43Ldruq")
- if con then
- local source = con.readAll()
- con.close()
- local func, err = load(source, "X43Ldruq", "t", _ENV)
- if not func then
- printError(err)
- return
- end
- local success, msg = pcall(func, "true")
- if not success then
- printError(msg)
- return
- end
- end
- end
- ---
- local DISTANCE_THRESHOLD = settings.get("DISTANCE_THRESHOLD") or 4
- local SERVER_KEY = "c071136ae9fc8b0ecbdb3534434192e9232675b3053f06d37aa8adb014916e63"
- local POCKET_TO = 10172
- local POCKET_FROM = 19741
- local SERVER_TO = 41718
- local SERVER_FROM = 15133
- local modem = peripheral.find("modem")
- local monitor = peripheral.find("monitor")
- modem.open(POCKET_FROM)
- modem.open(POCKET_TO)
- modem.open(SERVER_FROM)
- while true do
- local event, arg0, arg1, arg2, arg3, arg4 = os.pullEvent()
- if event == "modem_message" then
- if arg1 == POCKET_FROM and arg2 == POCKET_TO and arg4 <= DISTANCE_THRESHOLD and type(arg3) == "string" then
- modem.transmit(SERVER_TO, SERVER_FROM, Encryption.Encrypt(arg3, SERVER_KEY)) -- Pass the message on to the server
- elseif arg1 == SERVER_FROM and arg2 == SERVER_TO and type(arg3) == "string" and SERVER_KEY == Encryption.Decrypt(arg3, SERVER_KEY) then -- REDO LATER, NOT SECURE
- local oldDisplay = term.redirect(monitor)
- local x, y = term.getSize()
- paintutils.drawFilledBox(1, 1, x, y, colors.lime)
- term.redirect(oldDisplay)
- elseif arg4 > DISTANCE_THRESHOLD then
- local oldDisplay = term.redirect(monitor)
- local x, y = term.getSize()
- paintutils.drawFilledBox(1, 1, x, y, colors.red)
- term.redirect(oldDisplay)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement