fix: correct movement logic

This commit is contained in:
Emerson Rosen-Jones 2025-12-21 13:56:04 -05:00
parent 9a8f81e428
commit ef808abb94

View file

@ -212,8 +212,6 @@ function dropOffItems (starting_point, go_back)
print("Time to drop off what I got")
-- Turn off mining
mode.mine = { forward = true }
-- Note current position (assuming facing FORWARD)
local pos_state = getCurrentPos()
-- Return to origin, facing BACK
moveAbs(starting_point)
moveAbs(V_ZERO)
@ -224,10 +222,9 @@ function dropOffItems (starting_point, go_back)
turtle.drop()
end
turtle.select(1)
-- Return to current position, facing forward
-- Return to the mining zone, facing forward
if go_back then
moveAbs(starting_point)
moveAbs(pos_state)
end
end
@ -324,14 +321,13 @@ function split (block)
end
function process (stack, starting_point)
-- fuel and go to starting point
refuelUntil(FUEL_RESERVE)
mode.mine = { forward = true }
if #stack == 0 then return nil end
checkAndDropOff(starting_point)
local working = table.remove(stack):orient(getCurrentPos())
print("Working:", working:tostring())
if canMine(working) then
checkAndDropOff(starting_point)
mine(working)
else
local new, remainder = split(working, mode.v)
@ -349,7 +345,7 @@ function run (v1, v2)
process({ block }, starting_point)
-- return to base
dropOffItems(starting_point)
dropOffItems(starting_point, false)
turnToFace(FORWARD)
end