Update canemine
This commit is contained in:
parent
da2accfc67
commit
6fe4eee868
@ -39,22 +39,22 @@ function ithSpot(i)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function digTo(x, z)
|
-- function digTo(x, z)
|
||||||
print("Digging to rel. coord ("..tostring(x)..", "..tostring(z)..")")
|
-- print("Digging to ("..tostring(x)..", "..tostring(z)..")")
|
||||||
while z > 0 do
|
-- while z > 0 do
|
||||||
turtle.dig()
|
-- turtle.dig()
|
||||||
turtle.forward()
|
-- turtle.forward()
|
||||||
turtle.digUp()
|
-- turtle.digUp()
|
||||||
z = z - 1
|
-- z = z - 1
|
||||||
end
|
-- end
|
||||||
turtle.turnRight()
|
-- turtle.turnRight()
|
||||||
while x > 0 do
|
-- while x > 0 do
|
||||||
turtle.dig()
|
-- turtle.dig()
|
||||||
turtle.forward()
|
-- turtle.forward()
|
||||||
turtle.digUp()
|
-- turtle.digUp()
|
||||||
x = x - 1
|
-- x = x - 1
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
|
|
||||||
-- If the block in front of the turtle is desired, take it.
|
-- If the block in front of the turtle is desired, take it.
|
||||||
function grabOres()
|
function grabOres()
|
||||||
@ -115,9 +115,7 @@ function digShaft()
|
|||||||
selectCobble()
|
selectCobble()
|
||||||
turtle.placeUp()
|
turtle.placeUp()
|
||||||
turtle.down()
|
turtle.down()
|
||||||
print("Starting to dig shaft")
|
depth = digDeep(turtle.down, turtle.digDown, turtle.inspectDown, -1)
|
||||||
depth = digDeep(turtle.down, turtle.digDown, turtle.inspectDown, 3)
|
|
||||||
print("Dug the first shaft (depth = "..tostring(depth)..")")
|
|
||||||
turtle.turnLeft()
|
turtle.turnLeft()
|
||||||
digDeep(turtle.up, noop, noop, depth)
|
digDeep(turtle.up, noop, noop, depth)
|
||||||
turtle.turnLeft()
|
turtle.turnLeft()
|
||||||
@ -217,7 +215,7 @@ function reportDuty(id)
|
|||||||
moveSafeForward()
|
moveSafeForward()
|
||||||
moveSafeForward()
|
moveSafeForward()
|
||||||
rednet.open("bottom")
|
rednet.open("bottom")
|
||||||
rednet.broadcast(tostring(id), "jobcomplete")
|
rednet.broadcast(tostring(id), "jobs")
|
||||||
while true do
|
while true do
|
||||||
sender, message, proto = rednet.receive("jobcomplete")
|
sender, message, proto = rednet.receive("jobcomplete")
|
||||||
if message == "thanks" then
|
if message == "thanks" then
|
||||||
@ -262,14 +260,26 @@ function enqueueTurtle()
|
|||||||
turtle.turnLeft()
|
turtle.turnLeft()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function doRefuel()
|
||||||
|
turtle.select(1)
|
||||||
|
while turtle.getFuelLevel() < 1500 do
|
||||||
|
turtle.suck(1)
|
||||||
|
turtle.refuel(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function goToJob()
|
function goToJob()
|
||||||
moveSafeForward()
|
moveSafeForward()
|
||||||
|
turtle.turnRight()
|
||||||
|
doRefuel()
|
||||||
|
turtle.turnLeft()
|
||||||
moveSafeForward()
|
moveSafeForward()
|
||||||
moveSafeForward()
|
moveSafeForward()
|
||||||
moveSafeForward()
|
moveSafeForward()
|
||||||
end
|
end
|
||||||
|
|
||||||
function waitForJob()
|
function waitForJob()
|
||||||
|
print("Waiting for job...")
|
||||||
while true do
|
while true do
|
||||||
status, block = turtle.inspectDown()
|
status, block = turtle.inspectDown()
|
||||||
if status and block["name"] == "computercraft:wired_modem_full" then
|
if status and block["name"] == "computercraft:wired_modem_full" then
|
||||||
@ -279,9 +289,11 @@ function waitForJob()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
rednet.open("bottom")
|
rednet.open("bottom")
|
||||||
rednet.broadcast("Gimme gimme gimme", "needajob")
|
rednet.broadcast("gibjob", "jobs")
|
||||||
sender, message, proto = rednet.receive("newjob")
|
sender, message, proto = rednet.receive("newjob")
|
||||||
return tonumber(message)
|
job = tonumber(message)
|
||||||
|
print("Received job "..tostring(job))
|
||||||
|
return job
|
||||||
end
|
end
|
||||||
|
|
||||||
function emptyToBarrel()
|
function emptyToBarrel()
|
||||||
|
Loading…
Reference in New Issue
Block a user