mirror of
https://github.com/kepler155c/opus
synced 2024-12-29 10:00:26 +00:00
28 lines
562 B
Plaintext
28 lines
562 B
Plaintext
turtle.run(function()
|
|
require = requireInjector(getfenv(1))
|
|
local GPS = require('gps')
|
|
local Socket = require('socket')
|
|
|
|
local id = {COMPUTER_ID}
|
|
|
|
if not turtle.enableGPS() then
|
|
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
|
|
|
|
if not turtle.pathfind(pt, nil, 64) then
|
|
error('Unable to go to location')
|
|
end
|
|
end)
|