fix(robot-api): mutateRobotPosition
This commit is contained in:
parent
1b3a46e608
commit
f75f280193
@ -145,16 +145,9 @@ local function mineProcedure()
|
||||
|
||||
-- 1. Move
|
||||
if robotState.y > targetY then
|
||||
local ok, err = turtle.digDown()
|
||||
|
||||
if not ok then
|
||||
error('Cannot dig down because ' .. err)
|
||||
end
|
||||
|
||||
turtle.digDown()
|
||||
miner.robot.down()
|
||||
elseif robotState.dir == 'FORWARD' and robotState.z < targetZ then
|
||||
-- TODO: remove this print (debug purpose)
|
||||
print(robotState.z, targetZ)
|
||||
turtleUtils.digAll()
|
||||
miner.robot.forward()
|
||||
elseif robotState.dir == 'FORWARD' and robotState.z == targetZ then
|
||||
|
||||
@ -15,13 +15,13 @@ api.create = function()
|
||||
local incValue = 1
|
||||
if isBackward then invValue = -1 end
|
||||
|
||||
if dir == 'FORWARD' then
|
||||
if state.dir == 'FORWARD' then
|
||||
state.z = state.z + incValue
|
||||
elseif dir == 'BACKWARD' then
|
||||
elseif state.dir == 'BACKWARD' then
|
||||
state.z = state.z - incValue
|
||||
elseif dir == 'LEFT' then
|
||||
elseif state.dir == 'LEFT' then
|
||||
state.x = state.x - incValue
|
||||
elseif dir == 'RIGHT' then
|
||||
elseif state.dir == 'RIGHT' then
|
||||
state.x = state.x + incValue
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user