1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-23 03:37:40 +00:00

relative-gps coord system

This commit is contained in:
kepler155c@gmail.com
2017-05-24 19:48:48 -04:00
parent 64146f8625
commit e6ee432997
11 changed files with 62 additions and 57 deletions

View File

@@ -1,20 +1,16 @@
local function follow(id)
require = requireInjector(getfenv(1))
local GPS = require('gps')
local Socket = require('socket')
local Point = require('point')
local process = require('process')
turtle.status = 'follow ' .. id
local pt = GPS.getPointAndHeading()
if not pt or not pt.heading then
if not turtle.enableGPS() then
error('turtle: No GPS found')
end
turtle.setPoint(pt)
local socket = Socket.connect(id, 161)
if not socket then
error('turtle: Unable to connect to ' .. id)

View File

@@ -5,13 +5,10 @@ turtle.run(function()
local id = {COMPUTER_ID}
local pt = GPS.getPointAndHeading()
if not pt or not pt.heading then
if not turtle.enableGPS() then
error('turtle: No GPS found')
end
turtle.setPoint(pt)
local socket = Socket.connect(id, 161)
if not socket then
error('turtle: Unable to connect to ' .. id)

View File

@@ -7,6 +7,7 @@ local function summon(id)
turtle.status = 'GPSing'
turtle.setPoint({ x = 0, y = 0, z = 0, heading = 0 })
turtle.getState().coordSystem = 'relative'
local pts = {
[ 1 ] = { x = 0, z = 0, y = 0 },