Remove debug. Waiting for jobs now really waits
This commit is contained in:
parent
d95e1ec374
commit
372203d033
@ -128,7 +128,7 @@ function digShaft()
|
|||||||
selectCobble()
|
selectCobble()
|
||||||
turtle.placeUp()
|
turtle.placeUp()
|
||||||
turtle.down()
|
turtle.down()
|
||||||
depth = digDeep(turtle.down, turtle.digDown, turtle.inspectDown, 1)
|
depth = digDeep(turtle.down, turtle.digDown, turtle.inspectDown, -1)
|
||||||
turtle.turnLeft()
|
turtle.turnLeft()
|
||||||
digDeep(turtle.up, noop, noop, depth)
|
digDeep(turtle.up, noop, noop, depth)
|
||||||
turtle.turnLeft()
|
turtle.turnLeft()
|
||||||
@ -234,15 +234,14 @@ function reportDuty(id, fuelconsumed)
|
|||||||
moveSafeForward()
|
moveSafeForward()
|
||||||
moveSafeForward()
|
moveSafeForward()
|
||||||
moveSafeForward()
|
moveSafeForward()
|
||||||
print("Reporting Duty")
|
|
||||||
rednet.open("bottom")
|
rednet.open("bottom")
|
||||||
print("Proto: Sending completed Job id")
|
--print("Proto: Sending completed Job id")
|
||||||
rednet.broadcast(tostring(id), "jobs")
|
rednet.broadcast(tostring(id), "jobs")
|
||||||
sleep(0.6)
|
sleep(0.6)
|
||||||
print("Proto: Sending fuel status")
|
--print("Proto: Sending fuel status")
|
||||||
rednet.broadcast(tostring(fuelconsumed), "fuel")
|
rednet.broadcast(tostring(fuelconsumed), "fuel")
|
||||||
while true do
|
while true do
|
||||||
print("Proto: Awaiting thanks")
|
--print("Proto: Awaiting thanks")
|
||||||
sender, message, proto = rednet.receive("jobcomplete")
|
sender, message, proto = rednet.receive("jobcomplete")
|
||||||
if message == "thanks" then
|
if message == "thanks" then
|
||||||
break
|
break
|
||||||
@ -250,7 +249,7 @@ function reportDuty(id, fuelconsumed)
|
|||||||
sleep(1)
|
sleep(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
print("Proto: Received thanks")
|
--print("Proto: Received thanks")
|
||||||
end
|
end
|
||||||
|
|
||||||
function enqueueTurtle()
|
function enqueueTurtle()
|
||||||
@ -316,10 +315,14 @@ function waitForJob()
|
|||||||
end
|
end
|
||||||
rednet.open("bottom")
|
rednet.open("bottom")
|
||||||
rednet.broadcast("gibjob", "jobs")
|
rednet.broadcast("gibjob", "jobs")
|
||||||
sender, message, proto = rednet.receive("newjob")
|
while true do
|
||||||
job = tonumber(message)
|
sender, message, proto = rednet.receive("newjob", 1)
|
||||||
print("Received job "..tostring(job))
|
if message then
|
||||||
return job
|
job = tonumber(message)
|
||||||
|
print("Received job "..tostring(job))
|
||||||
|
return job
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function emptyToBarrel()
|
function emptyToBarrel()
|
||||||
@ -345,7 +348,8 @@ while true do
|
|||||||
emptyToBarrel()
|
emptyToBarrel()
|
||||||
leaveBarrel(path)
|
leaveBarrel(path)
|
||||||
fuelconsumed = fuel - turtle.getFuelLevel()
|
fuelconsumed = fuel - turtle.getFuelLevel()
|
||||||
reportDuty(thejob, fuelconsumed)
|
|
||||||
print("I consumed "..tostring(fuelconsumed).." fuel")
|
print("I consumed "..tostring(fuelconsumed).." fuel")
|
||||||
|
print("Reporting Duty")
|
||||||
|
reportDuty(thejob, fuelconsumed)
|
||||||
enqueueTurtle()
|
enqueueTurtle()
|
||||||
end
|
end
|
||||||
|
@ -21,7 +21,7 @@ while true do
|
|||||||
if not message then
|
if not message then
|
||||||
sleep(0.6)
|
sleep(0.6)
|
||||||
else
|
else
|
||||||
print("> raw: "..message)
|
--print("> raw: "..message)
|
||||||
if message == "gibjob" then
|
if message == "gibjob" then
|
||||||
if rs.getInput("right") then
|
if rs.getInput("right") then
|
||||||
job = getNextJob()
|
job = getNextJob()
|
||||||
|
Loading…
Reference in New Issue
Block a user