Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local radar = peripheral.find("radar") -- assuming the radar peripheral is connected to the computer
- -- set the range to scan (in blocks)
- local range = 100
- -- get the coordinates of the computer
- local x, y, z = gps.locate()
- -- scan for ships within the range
- local ships = radar.scanShips(x-range, y-range, z-range, x+range, y+range, z+range)
- -- print the number of ships found
- print("Number of ships found: " .. #ships)
- -- print the coordinates of each ship
- for i, ship in ipairs(ships) do
- print("Ship " .. i .. " found at (" .. ship.x .. ", " .. ship.y .. ", " .. ship.z .. ")")
- end
Advertisement
Add Comment
Please, Sign In to add comment