Progress on mineleader.

This commit is contained in:
Harrison Deng 2021-05-05 18:48:41 -05:00
parent 5a05ede075
commit 2c4d70fe08

View File

@ -373,14 +373,14 @@ local function moveTo(dest, range)
end
local xBlocked, yBlocked, zBlocked = false, false, false
local oldPos = nil
while oldPos == nil or not vectorEqual(dest, position) do
while not vectorEqual(dest, position) do
if oldPos ~= nil and vectorEqual(oldPos, position) then
sendLog(FAILED, "Cannot proceed to due obstacle.")
return
end
oldPos = vector.new(position.x, position.y, position.z);
if position.x ~= dest.x then
if not orient(vector.new(dest.x - position.x, 0, 0), heading, rightAxis) then
if not orient(vector.new(dest.x - position.x, 0, 0):normalize(), heading, rightAxis) then
sendLog(FAILED, "Unable to orient for X axis.")
return
end
@ -394,7 +394,7 @@ local function moveTo(dest, range)
end
end
if position.z ~= dest.z then
if not orient(vector.new(0, 0, dest.z - position.z), heading, rightAxis) then
if not orient(vector.new(0, 0, dest.z - position.z):normalize(), heading, rightAxis) then
sendLog(FAILED, "Unable to orient for Z axis.")
return
end