Finalize(?) client
This commit is contained in:
parent
51287b6d03
commit
c08d6e973b
@ -566,7 +566,7 @@ function goToJob2(job)
|
|||||||
moveSafe(turtle.forward, turtle.inspect, noop)
|
moveSafe(turtle.forward, turtle.inspect, noop)
|
||||||
moveSafe(turtle.forward, turtle.inspect, noop)
|
moveSafe(turtle.forward, turtle.inspect, noop)
|
||||||
-- reset coords, descend
|
-- reset coords, descend
|
||||||
x, z = 0, 0
|
x, z, direction = 0, 0, 0
|
||||||
moveSafe(turtle.down, turtle.inspectDown, noop)
|
moveSafe(turtle.down, turtle.inspectDown, noop)
|
||||||
moveSafe(turtle.down, turtle.inspectDown, noop)
|
moveSafe(turtle.down, turtle.inspectDown, noop)
|
||||||
moveSafe(turtle.down, turtle.inspectDown, noop)
|
moveSafe(turtle.down, turtle.inspectDown, noop)
|
||||||
@ -633,6 +633,36 @@ function goToUnloading()
|
|||||||
moveSafe(turtle.forward, turtle.inspect, noop)
|
moveSafe(turtle.forward, turtle.inspect, noop)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function reportDuty2()
|
||||||
|
updateState({ state = "Returning to report duty..." })
|
||||||
|
moveSafe(turtle.up, turtle.inspectUp, noop)
|
||||||
|
moveSafe(turtle.up, turtle.inspectUp, noop)
|
||||||
|
moveSafe(turtle.up, turtle.inspectUp, noop)
|
||||||
|
moveSafe(turtle.up, turtle.inspectUp, noop)
|
||||||
|
for i = 1,11 do
|
||||||
|
moveSafeForward()
|
||||||
|
end
|
||||||
|
rednet.open("top")
|
||||||
|
id = turtlestate["job"]
|
||||||
|
fuelconsumed = turtlestate["fuel"]
|
||||||
|
rednet.broadcast(tostring(id), "jobs")
|
||||||
|
sleep(0.6)
|
||||||
|
--print("Proto: Sending fuel status")
|
||||||
|
rednet.broadcast(tostring(fuelconsumed), "fuel")
|
||||||
|
while true do
|
||||||
|
--print("Proto: Awaiting thanks")
|
||||||
|
updateState({ state = "Waiting for thanks..." })
|
||||||
|
sender, message, proto = rednet.receive("jobcomplete", 2)
|
||||||
|
if message == "thanks" then
|
||||||
|
break
|
||||||
|
else
|
||||||
|
sleep(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--print("Proto: Received thanks")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function turtleAI2()
|
function turtleAI2()
|
||||||
while true do
|
while true do
|
||||||
local job = enqueueForJob2()
|
local job = enqueueForJob2()
|
||||||
@ -641,9 +671,12 @@ function turtleAI2()
|
|||||||
digShaft()
|
digShaft()
|
||||||
goToUnloading()
|
goToUnloading()
|
||||||
unloadStuffs()
|
unloadStuffs()
|
||||||
-- returnToQueue()
|
reportDuty2()
|
||||||
updateState({ state = "Fin" })
|
moveSafe(turtle.down, turtle.inspectDown, turtle.digDown)
|
||||||
break
|
moveSafe(turtle.down, turtle.inspectDown, turtle.digDown)
|
||||||
|
moveSafe(turtle.down, turtle.inspectDown, turtle.digDown)
|
||||||
|
moveSafe(turtle.down, turtle.inspectDown, turtle.digDown)
|
||||||
|
turtle.turnLeft()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- turtleAI()
|
-- turtleAI()
|
||||||
|
Loading…
Reference in New Issue
Block a user