Merge branch 'master' of leafbla.de:dominic/turtles

This commit is contained in:
Dominic Zimmer 2020-07-09 10:14:34 +02:00
commit e84d807957

View File

@ -111,22 +111,15 @@ local state_machine = {
local x, z = calculate_tree_position(T.state.current_row, T.state.current_tree) local x, z = calculate_tree_position(T.state.current_row, T.state.current_tree)
local o 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 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 -- we just turned towards a new row and are approaching in positive x direction
x = x - 1 x = x - 1
o = "+x" o = "+x"
elseif T.state.current_row % 2 == 0 then elseif T.state.current_row % 2 == 0 then
print("even row")
-- we are in an even row and approaching in positive z direction -- we are in an even row and approaching in positive z direction
z = z - 1 z = z - 1
o = "+z" o = "+z"
else else
print("odd row")
-- we are approaching in negative z direction -- we are approaching in negative z direction
z = z + 1 z = z + 1
o = "-z" o = "-z"
@ -165,8 +158,6 @@ local state_machine = {
end end
turtle.digUp() turtle.digUp()
if T.state.y == TREE_MAX_Y - 1 then 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 -- we are below the last log, no need to move up
break break
end end
@ -206,6 +197,7 @@ local state_machine = {
end, end,
["OUTPUT"] = function() ["OUTPUT"] = function()
greedy_move(OUTPUT_TARGET.x, OUTPUT_TARGET.z, OUTPUT_TARGET.o) greedy_move(OUTPUT_TARGET.x, OUTPUT_TARGET.z, OUTPUT_TARGET.o)
-- Drop all logs -- Drop all logs
@ -221,6 +213,7 @@ local state_machine = {
end, end,
["RESUPPLY_SAPS"] = function() ["RESUPPLY_SAPS"] = function()
greedy_move(SAPS_TARGET.x, SAPS_TARGET.z, SAPS_TARGET.o) greedy_move(SAPS_TARGET.x, SAPS_TARGET.z, SAPS_TARGET.o)
turtle.select(SAP_SLOT) turtle.select(SAP_SLOT)
@ -233,6 +226,7 @@ local state_machine = {
end, end,
["RESUPPLY_FUEL"] = function() ["RESUPPLY_FUEL"] = function()
greedy_move(FUEL_TARGET.x, FUEL_TARGET.z, FUEL_TARGET.o) greedy_move(FUEL_TARGET.x, FUEL_TARGET.z, FUEL_TARGET.o)
if turtle.getFuelLevel() < FUEL_LEVEL_TARGET then if turtle.getFuelLevel() < FUEL_LEVEL_TARGET then