From 22acaca89fd9470e9bc0604dcadea1bb33d08b92 Mon Sep 17 00:00:00 2001 From: Harrison Deng Date: Mon, 3 May 2021 15:28:43 -0500 Subject: [PATCH] Changed heading calculation. --- mineleader.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mineleader.lua b/mineleader.lua index acfaa5c..c8eac81 100644 --- a/mineleader.lua +++ b/mineleader.lua @@ -251,29 +251,27 @@ local function determineHeading() sendLog(FAILED, "Could not move to get delta.") return end - if x == nil then + if position == nil then sendLog(FAILED, "Could not locate.") return end - heading = position - oldPos + local fDelta = position - oldPos if not attemptMoveRight() then sendLog(FAILED, "Unable to rotate right.") - heading = nil return end local oldPos = vector.new(position.x, position.y, position.z) if not attemptMoveForward() then sendLog(FAILED, "Unable to move forward after rotation.") - heading = nil return end if not attemptMoveLeft() then sendLog(FAILED, "Unable to rotate left.") - heading = nil return end + heading = fDelta rightAxis = position - oldPos end