Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- if #tArgs ~= 1 and #tArgs ~= 4 then
- print("Usage: ")
- print("Scan <filter>")
- print("Scan <filter> [x] [y] [z]")
- error()
- end
- local gps_enabled = false
- if gps and gps.locate and gps.locate() then
- gps_enabled = true
- end
- print("Scanning...")
- p = peripheral.wrap("top")
- tbl = p.scan(8)
- for i,v in pairs(tbl) do
- if v.name:find(tArgs[1]) then
- if #tArgs == 4 then
- print(tArgs[2]+v.x, tArgs[3]+v.y, tArgs[4]+v.z)
- else
- if gps_enabled then
- local x,y,z = gps.locate()
- print(x+v.x, y+v.y, z+v.z)
- else
- print("Found")
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment