Changing move here to work with changes to move to.
This commit is contained in:
parent
9e9ea5dd2f
commit
68d94036cc
@ -19,7 +19,6 @@ local HEADING = "heading"
|
|||||||
local QUARRY = "quarry"
|
local QUARRY = "quarry"
|
||||||
local TASK = "task"
|
local TASK = "task"
|
||||||
local FAILED = "failed"
|
local FAILED = "failed"
|
||||||
-- Constant local actions
|
|
||||||
local MOVEHERE = "movehere"
|
local MOVEHERE = "movehere"
|
||||||
-- Constant messsage types
|
-- Constant messsage types
|
||||||
local LOG = "LOG"
|
local LOG = "LOG"
|
||||||
@ -89,7 +88,7 @@ local function listenForCommands()
|
|||||||
elseif string.find(input, MOVEHERE) == 1 then
|
elseif string.find(input, MOVEHERE) == 1 then
|
||||||
local x, y, z = gps.locate()
|
local x, y, z = gps.locate()
|
||||||
y = y + 1
|
y = y + 1
|
||||||
sendDirective(LEADER, MOVETO, x, y, z)
|
sendDirective(LEADER, MOVEHERE, x, y, z)
|
||||||
elseif string.find(input, QUARRY) == 1 then
|
elseif string.find(input, QUARRY) == 1 then
|
||||||
deltasRaw = string.sub(input, string.len(QUARRY) + 1 + 1)
|
deltasRaw = string.sub(input, string.len(QUARRY) + 1 + 1)
|
||||||
local deltas = captureString(deltasRaw, "([+-]?%d+)")
|
local deltas = captureString(deltasRaw, "([+-]?%d+)")
|
||||||
|
@ -15,6 +15,7 @@ local HEADING = "heading"
|
|||||||
local QUARRY = "quarry"
|
local QUARRY = "quarry"
|
||||||
local TASK = "task"
|
local TASK = "task"
|
||||||
local FAILED = "failed"
|
local FAILED = "failed"
|
||||||
|
local MOVEHERE = "movehere"
|
||||||
-- Constant messaging
|
-- Constant messaging
|
||||||
local LOG = "LOG"
|
local LOG = "LOG"
|
||||||
local REQUEST = "REQ"
|
local REQUEST = "REQ"
|
||||||
@ -387,7 +388,7 @@ local function moveTo(dest, relative)
|
|||||||
|
|
||||||
dest = dest:round()
|
dest = dest:round()
|
||||||
sendLog(MOVETO, "Attempting to move by (" .. dest.x .. "," .. dest.y .. "," .. dest.z .. ") (x,y,z).")
|
sendLog(MOVETO, "Attempting to move by (" .. dest.x .. "," .. dest.y .. "," .. dest.z .. ") (x,y,z).")
|
||||||
if position == nil or heading == nil then
|
if pos == nil or forward == nil then
|
||||||
sendLog(FAILED, "Position or heading is invalid.")
|
sendLog(FAILED, "Position or heading is invalid.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -445,7 +446,6 @@ local function moveTo(dest, relative)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function quarry(x, y, z, relative, pattern)
|
local function quarry(x, y, z, relative, pattern)
|
||||||
x = tonumber(x)
|
x = tonumber(x)
|
||||||
y = tonumber(y)
|
y = tonumber(y)
|
||||||
@ -608,6 +608,11 @@ local function listen()
|
|||||||
"\nPosition: " .. (status["position"]["coordinates"] and textutils.serialiseJSON(status["position"]) or "not positioned.") ..
|
"\nPosition: " .. (status["position"]["coordinates"] and textutils.serialiseJSON(status["position"]) or "not positioned.") ..
|
||||||
"\nfuel: " .. tostring(status["fuel"]) ..
|
"\nfuel: " .. tostring(status["fuel"]) ..
|
||||||
"\ncurrent task: " .. status["task"], status)
|
"\ncurrent task: " .. status["task"], status)
|
||||||
|
elseif data["request"] == MOVEHERE then
|
||||||
|
local x = data["content"][1]
|
||||||
|
local y = data["content"][2]
|
||||||
|
local z = data["content"][3]
|
||||||
|
moveTo(vector.new(x, y, z), false)
|
||||||
elseif data["request"] == POSITION then
|
elseif data["request"] == POSITION then
|
||||||
determinePosition()
|
determinePosition()
|
||||||
elseif data["request"] == HEADING then
|
elseif data["request"] == HEADING then
|
||||||
|
Loading…
Reference in New Issue
Block a user