Merge netherite/excavation controllers, overhaul movement logic with verticality support
This commit is contained in:
@ -107,9 +107,13 @@ function TurtleController:MoveForward(number_of_blocks, skip_unstocking, skip_re
|
||||
self:UnstockIfFull()
|
||||
end
|
||||
|
||||
-- Mine
|
||||
-- Mine/Move
|
||||
if self.mine_forward then
|
||||
turtle.dig()
|
||||
while not turtle.forward() do
|
||||
turtle.dig()
|
||||
end
|
||||
elseif not turtle.forward() then
|
||||
error("Turtle failed to move forward!")
|
||||
end
|
||||
if self.mine_above then
|
||||
turtle.digUp()
|
||||
@ -118,11 +122,6 @@ function TurtleController:MoveForward(number_of_blocks, skip_unstocking, skip_re
|
||||
turtle.digDown()
|
||||
end
|
||||
|
||||
-- Move
|
||||
if not turtle.forward() then
|
||||
error("Turtle failed to move forward!")
|
||||
end
|
||||
|
||||
-- Update current position
|
||||
if self.position.dir == Direction.NORTH then
|
||||
self.position.z = self.position.z + 1
|
||||
@ -181,6 +180,12 @@ function TurtleController:MoveVertical(number_of_blocks, skip_unstocking, skip_r
|
||||
end
|
||||
|
||||
|
||||
---Stores the current position on the stack so we can return using TurtleController:MoveBack()
|
||||
function TurtleController:StorePosition()
|
||||
self.last_positions:Push(Position:Copy(self.position))
|
||||
end
|
||||
|
||||
|
||||
---Move to an absolute position. Stores the current position on the stack so we can return using TurtleController:MoveBack()
|
||||
---@param x number The EAST/WEST axis (grows from WEST to EAST)
|
||||
---@param y number The UP/DOWN axis (grows from DOWN to UP)
|
||||
|
||||
Reference in New Issue
Block a user