Merge branch 'master' of leafbla.de:dominic/turtles
This commit is contained in:
commit
e84d807957
@ -111,22 +111,15 @@ local state_machine = {
|
||||
local x, z = calculate_tree_position(T.state.current_row, T.state.current_tree)
|
||||
local o
|
||||
|
||||
if T.state.current_tree < 3 or T.state.current_tree > 12 then
|
||||
breakpoint()
|
||||
end
|
||||
|
||||
if T.state.current_row ~= 1 and T.state.current_tree == 1 then
|
||||
print("new row")
|
||||
-- we just turned towards a new row and are approaching in positive x direction
|
||||
x = x - 1
|
||||
o = "+x"
|
||||
elseif T.state.current_row % 2 == 0 then
|
||||
print("even row")
|
||||
-- we are in an even row and approaching in positive z direction
|
||||
z = z - 1
|
||||
o = "+z"
|
||||
else
|
||||
print("odd row")
|
||||
-- we are approaching in negative z direction
|
||||
z = z + 1
|
||||
o = "-z"
|
||||
@ -165,8 +158,6 @@ local state_machine = {
|
||||
end
|
||||
turtle.digUp()
|
||||
if T.state.y == TREE_MAX_Y - 1 then
|
||||
print("below last log")
|
||||
breakpoint()
|
||||
-- we are below the last log, no need to move up
|
||||
break
|
||||
end
|
||||
@ -206,6 +197,7 @@ local state_machine = {
|
||||
end,
|
||||
|
||||
["OUTPUT"] = function()
|
||||
|
||||
greedy_move(OUTPUT_TARGET.x, OUTPUT_TARGET.z, OUTPUT_TARGET.o)
|
||||
|
||||
-- Drop all logs
|
||||
@ -221,6 +213,7 @@ local state_machine = {
|
||||
end,
|
||||
|
||||
["RESUPPLY_SAPS"] = function()
|
||||
|
||||
greedy_move(SAPS_TARGET.x, SAPS_TARGET.z, SAPS_TARGET.o)
|
||||
|
||||
turtle.select(SAP_SLOT)
|
||||
@ -233,6 +226,7 @@ local state_machine = {
|
||||
end,
|
||||
|
||||
["RESUPPLY_FUEL"] = function()
|
||||
|
||||
greedy_move(FUEL_TARGET.x, FUEL_TARGET.z, FUEL_TARGET.o)
|
||||
|
||||
if turtle.getFuelLevel() < FUEL_LEVEL_TARGET then
|
||||
|
Loading…
Reference in New Issue
Block a user