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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user