Orientation system changed.
This commit is contained in:
parent
e3e7431d87
commit
366b3f6a0a
@ -250,15 +250,17 @@ end
|
||||
|
||||
local function orient(v, forward, right)
|
||||
print("Attempting to orient such that " .. tostring(v) .. " == " .. tostring(forward) .. ".")
|
||||
v = v:normalize()
|
||||
v = v / (v:length() * v:normalize())
|
||||
if vectorEqual(v, forward) then
|
||||
return true
|
||||
elseif vectorEqual(v, right) then
|
||||
return attemptMoveRight()
|
||||
elseif vectorEqual(v, -right) then
|
||||
return attemptMoveLeft()
|
||||
else
|
||||
elseif vectorEqual(v, -forward) then
|
||||
return attemptMoveRight() and attemptMoveRight()
|
||||
else
|
||||
sendLog(FAILED, "Improper axis given.");
|
||||
end
|
||||
return false
|
||||
end
|
||||
@ -368,7 +370,7 @@ local function moveBy(delta, forward, right)
|
||||
end
|
||||
|
||||
local function moveTo(dest)
|
||||
dest = vector.new(math.floor(dest.x), math.floor(dest.y), math.floor(dest.z))
|
||||
dest = dest:round()
|
||||
sendLog(MOVETO, "Attempting to move by (" .. dest.x .. "," .. dest.y .. "," .. dest.z .. ") (x,y,z).")
|
||||
if position == nil or heading == nil then
|
||||
sendLog(FAILED, "Position or heading is invalid.")
|
||||
@ -436,8 +438,7 @@ local function quarry(x, y, z, forward, right, pattern)
|
||||
for xDelta=1,math.abs(x) do
|
||||
for zDelta=1,math.abs(z) do
|
||||
local success = true;
|
||||
if (reverseTrip) then
|
||||
orient(vector.new(0,0,-z), forward, right)
|
||||
orient(vector.new(0,0, -z), forward, right)
|
||||
else
|
||||
orient(vector.new(0, 0, z), forward, right)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user