Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local c = require("component")
- local geo = c.geolyzer
- local tunnel = c.tunnel
- local event = require("event")
- local ser = require("serialization")
- local coords = {}
- local rows = {}
- local radius
- local function isInt(n)
- n = pcall(function() return n==math.floor(n) end)
- return not n
- end
- local function readCoordinates(cor)
- local w = {}
- for word in string.gmatch(cor,"%S+") do
- table.insert(w,word)
- end
- coords = {
- x = w[1],
- y = w[2],
- z = w[3]
- }
- end
- io.write("Your coordinates: ")
- readCoordinates(io.read())
- if coords.x == nil or coords.y == nil or coords.z == nil then
- print("You didn't type them in correctly.")
- coords = {
- x = -3042,
- y = 56,
- z = 3031,
- }
- end
- io.write("Radius: ")
- radius = io.read()
- if radius == "" or isInt(radius) then
- print("You didn't type it in correctly.")
- radius = 5
- end
- tunnel.send("UserData",ser.serialize(coords),radius)
- os.sleep(1)
- for x=-radius,radius-1 do
- for z=-radius,radius-1 do
- print("Scanning: " .. x .. " " .. z)
- table.insert(rows,ser.serialize(geo.scan(x,z,false)))
- end
- end
- io.write("Scan Complete. Send data?[Y/n] ")
- if string.lower(io.read()) == "y" then
- tunnel.send("maxPack",#rows)
- os.sleep(0.2)
- for i=1,#rows,4 do
- tunnel.send("Data",rows[i],rows[i+1],rows[i+2],rows[i+3])
- print("Sending package " .. i .. "/" .. #rows .. ".")
- os.sleep(0.2)
- end
- print("Sending package " .. #rows .. "/" .. #rows .. ".")
- print("Data sent.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement