Mine: find shaft: mine whole lobby
This commit is contained in:
parent
48f92744f7
commit
6f414f3544
|
@ -165,14 +165,25 @@ end
|
||||||
|
|
||||||
-- Find the next unmined shaft and end up in front of it
|
-- Find the next unmined shaft and end up in front of it
|
||||||
function find_next_shaft()
|
function find_next_shaft()
|
||||||
|
function is_shaft_pos()
|
||||||
|
if side % 2 == 1 then
|
||||||
|
return false
|
||||||
|
elseif side % 4 == 0 then
|
||||||
|
return height % 3 == 0
|
||||||
|
elseif side % 4 == 2 then
|
||||||
|
return height % 3 ~= 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function is_shaft()
|
||||||
|
return is_shaft_pos() and turtle.detect()
|
||||||
|
end
|
||||||
|
|
||||||
go_to(0, 0, 0)
|
go_to(0, 0, 0)
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
for hei=1,MAX_HEIGHT-1 do
|
for hei=1,MAX_HEIGHT-1 do
|
||||||
if (height % 3) == 0 then
|
if is_shaft() then
|
||||||
if turtle.detect() then
|
return
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if turtle.detectUp() then
|
if turtle.detectUp() then
|
||||||
|
@ -180,24 +191,20 @@ function find_next_shaft()
|
||||||
end
|
end
|
||||||
move_up()
|
move_up()
|
||||||
end
|
end
|
||||||
if turtle.detect() then
|
if is_shaft() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
turn_abs(1)
|
turn_abs(1)
|
||||||
for i=0,1 do
|
if turtle.detect() then
|
||||||
if turtle.detect() then
|
turtle.dig()
|
||||||
turtle.dig()
|
|
||||||
end
|
|
||||||
move_forward()
|
|
||||||
end
|
end
|
||||||
|
move_forward()
|
||||||
turn_abs(0)
|
turn_abs(0)
|
||||||
|
|
||||||
for hei=MAX_HEIGHT-1,1,-1 do
|
for hei=MAX_HEIGHT-1,1,-1 do
|
||||||
if (height % 3) ~= 0 then
|
if is_shaft() then
|
||||||
if turtle.detect() then
|
return
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if turtle.detectDown() then
|
if turtle.detectDown() then
|
||||||
|
@ -205,14 +212,15 @@ function find_next_shaft()
|
||||||
end
|
end
|
||||||
move_down()
|
move_down()
|
||||||
end
|
end
|
||||||
|
if is_shaft() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
turn_abs(1)
|
turn_abs(1)
|
||||||
for i=0,1 do
|
if turtle.detect() then
|
||||||
if turtle.detect() then
|
turtle.dig()
|
||||||
turtle.dig()
|
|
||||||
end
|
|
||||||
move_forward()
|
|
||||||
end
|
end
|
||||||
|
move_forward()
|
||||||
turn_abs(0)
|
turn_abs(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue