Remove debug. Waiting for jobs now really waits

This commit is contained in:
Dominic Zimmer 2020-07-05 12:56:24 +02:00
parent d95e1ec374
commit 372203d033
2 changed files with 16 additions and 12 deletions

View File

@ -128,7 +128,7 @@ function digShaft()
selectCobble()
turtle.placeUp()
turtle.down()
depth = digDeep(turtle.down, turtle.digDown, turtle.inspectDown, 1)
depth = digDeep(turtle.down, turtle.digDown, turtle.inspectDown, -1)
turtle.turnLeft()
digDeep(turtle.up, noop, noop, depth)
turtle.turnLeft()
@ -234,15 +234,14 @@ function reportDuty(id, fuelconsumed)
moveSafeForward()
moveSafeForward()
moveSafeForward()
print("Reporting Duty")
rednet.open("bottom")
print("Proto: Sending completed Job id")
--print("Proto: Sending completed Job id")
rednet.broadcast(tostring(id), "jobs")
sleep(0.6)
print("Proto: Sending fuel status")
--print("Proto: Sending fuel status")
rednet.broadcast(tostring(fuelconsumed), "fuel")
while true do
print("Proto: Awaiting thanks")
--print("Proto: Awaiting thanks")
sender, message, proto = rednet.receive("jobcomplete")
if message == "thanks" then
break
@ -250,7 +249,7 @@ function reportDuty(id, fuelconsumed)
sleep(1)
end
end
print("Proto: Received thanks")
--print("Proto: Received thanks")
end
function enqueueTurtle()
@ -316,10 +315,14 @@ function waitForJob()
end
rednet.open("bottom")
rednet.broadcast("gibjob", "jobs")
sender, message, proto = rednet.receive("newjob")
while true do
sender, message, proto = rednet.receive("newjob", 1)
if message then
job = tonumber(message)
print("Received job "..tostring(job))
return job
end
end
end
function emptyToBarrel()
@ -345,7 +348,8 @@ while true do
emptyToBarrel()
leaveBarrel(path)
fuelconsumed = fuel - turtle.getFuelLevel()
reportDuty(thejob, fuelconsumed)
print("I consumed "..tostring(fuelconsumed).." fuel")
print("Reporting Duty")
reportDuty(thejob, fuelconsumed)
enqueueTurtle()
end

View File

@ -21,7 +21,7 @@ while true do
if not message then
sleep(0.6)
else
print("> raw: "..message)
--print("> raw: "..message)
if message == "gibjob" then
if rs.getInput("right") then
job = getNextJob()