Compare commits

..

No commits in common. "8f396e50275b5789cc260061ab6bde75533f9edb" and "b3f659b2b7fc48b295503b985fc502275af3fd62" have entirely different histories.

View File

@ -83,7 +83,7 @@ function digSafe(inspectAction, digAction)
if status then
if block["name"]:lower():find("turtle") then
-- turtle in front of me. its free space
break
return true
else
digAction()
-- gravel may take time to fall.
@ -91,7 +91,7 @@ function digSafe(inspectAction, digAction)
end
else
-- No block in front of me. good
break
return true
end
end
end
@ -513,7 +513,7 @@ function faceDir(dir)
end
end
-- directions: 0, 1, 2, 3 -> x, z, -x, -z
function goToCoordXZ2(targetX, targetZ, extraaction)
function goToCoordXZ(targetX, targetZ, extraaction)
if targetX > x then
faceDir(0)
while (targetX > x) do
@ -548,7 +548,7 @@ function goToCoordXZ2(targetX, targetZ, extraaction)
end
end
function goToJob2(job)
function goToJob(job)
jobX, jobZ = iTo2Dcoords(job) -- this does all the magic
updateState({ state = "Going on the job...", morestate = " Jobsite is at ("..tostring(jobX)..", "..tostring(jobZ)..")" })
-- move to hole
@ -564,18 +564,25 @@ function goToJob2(job)
moveSafe(turtle.down, turtle.inspectDown, noop)
-- go to job
function extraaction()
digSafe(turtle.inspectUp, turtle.digUp())
repeat sleep(0.6) until (not digSafe(turtle.inspectUp, turtle.digUp()))
end
goToCoordXZ2(jobX, jobZ, extraaction)
goToCoord(jobX, jobZ, extraaction)
end
function turtleAI2()
while true do
local job = enqueueForJob2()
goToJob2(job)
goToJob(job)
-- returnToQueue()
break
end
end
turtleAI2()
function extraaction()
repeat sleep(0.6) until (not digSafe(turtle.inspectUp, turtle.digUp()))
end
-- turtleAI()
faceDir(3)
goToCoordXZ(4, 2, extraaction)
goToCoordXZ(0, 0, extraaction)
goToCoordXZ(4, 2, extraaction)