2016-12-11 19:24:52 +00:00
|
|
|
turtle.run(function()
|
2017-09-05 06:09:31 +00:00
|
|
|
|
|
|
|
requireInjector(getfenv(1))
|
|
|
|
|
|
|
|
local GPS = require('gps')
|
2016-12-11 19:24:52 +00:00
|
|
|
local Socket = require('socket')
|
|
|
|
|
|
|
|
local id = {COMPUTER_ID}
|
|
|
|
|
2017-05-24 23:48:48 +00:00
|
|
|
if not turtle.enableGPS() then
|
2016-12-11 19:24:52 +00:00
|
|
|
error('turtle: No GPS found')
|
|
|
|
end
|
|
|
|
|
|
|
|
local socket = Socket.connect(id, 161)
|
|
|
|
if not socket then
|
|
|
|
error('turtle: Unable to connect to ' .. id)
|
|
|
|
end
|
|
|
|
|
|
|
|
socket:write({ type = 'gps' })
|
|
|
|
|
|
|
|
local pt = socket:read(3)
|
|
|
|
if not pt then
|
|
|
|
error('turtle: No GPS response')
|
|
|
|
end
|
|
|
|
|
2017-09-13 03:04:44 +00:00
|
|
|
if not turtle.pathfind(pt) then
|
2016-12-11 19:24:52 +00:00
|
|
|
error('Unable to go to location')
|
|
|
|
end
|
|
|
|
end)
|