This commit is contained in:
Kai Vogelgesang 2020-07-08 13:30:00 +02:00
parent 88a94caf74
commit 563ae7dd3c

View File

@ -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"
@ -206,6 +199,9 @@ local state_machine = {
end,
["OUTPUT"] = function()
breakpoint()
greedy_move(OUTPUT_TARGET.x, OUTPUT_TARGET.z, OUTPUT_TARGET.o)
-- Drop all logs
@ -221,6 +217,9 @@ local state_machine = {
end,
["RESUPPLY_SAPS"] = function()
breakpoint()
greedy_move(SAPS_TARGET.x, SAPS_TARGET.z, SAPS_TARGET.o)
turtle.select(SAP_SLOT)
@ -233,6 +232,9 @@ local state_machine = {
end,
["RESUPPLY_FUEL"] = function()
breakpoint()
greedy_move(FUEL_TARGET.x, FUEL_TARGET.z, FUEL_TARGET.o)
if turtle.getFuelLevel() < FUEL_LEVEL_TARGET then