Fixing wrong function calls

This commit is contained in:
sascham 2020-12-20 16:21:40 +00:00
parent 55ef03625a
commit 4b2201e544

View File

@ -25,6 +25,7 @@ while true do
if item ~= nil and item['name'] ~= 'minecraft:' .. TREE_SAPLING .. '_sapling' then if item ~= nil and item['name'] ~= 'minecraft:' .. TREE_SAPLING .. '_sapling' then
turtle.select(i) turtle.select(i)
print('Dropping ' .. item['name'] .. ' into chest.')
turtle.drop() turtle.drop()
end end
end end
@ -40,7 +41,7 @@ while true do
turtle.turnLeft() turtle.turnLeft()
for i = 1, NUM_OF_TREES do for i = 1, NUM_OF_TREES do
for j = 1, 3 do for j = 1, 3 do
check_fuel() modules.check_fuel()
if i ~= 3 * NUM_OF_TREES then if i ~= 3 * NUM_OF_TREES then
turtle.dig() turtle.dig()
end end
@ -49,10 +50,10 @@ while true do
turtle.turnLeft() turtle.turnLeft()
blockExists, item = turtle.inspect() blockExists, item = turtle.inspect()
if blockExists and item['name'] == 'minecraft:' .. TREE_SAPLING .. '_log' then if blockExists and item['name'] == 'minecraft:' .. TREE_SAPLING .. '_log' then
modules.selectEmptySlot() modules.select_emptySlot()
shell.run('choptree.lua') -- Run Choptree shell.run('choptree.lua') -- Run Choptree
elseif blockExists and item['name'] ~= 'minecraft:' .. TREE_SAPLING .. '_sapling' then elseif blockExists and item['name'] ~= 'minecraft:' .. TREE_SAPLING .. '_sapling' then
print('Error! Wrong block') print('Error! Wrong block. Found ' .. item['name'])
elseif not blockExists then elseif not blockExists then
turtle.forward() turtle.forward()
local success, underneath = turtle.inspectDown() local success, underneath = turtle.inspectDown()
@ -61,7 +62,8 @@ while true do
turtle.back() turtle.back()
else else
turtle.back() turtle.back()
modules.selectItem('minecraft:' .. TREE_SAPLING .. '_sapling') print('Planting seed.')
modules.select_item('minecraft:' .. TREE_SAPLING .. '_sapling')
turtle.place() turtle.place()
end end
end end
@ -71,12 +73,13 @@ while true do
-- Move forward to the chest again -- Move forward to the chest again
turtle.turnLeft() turtle.turnLeft()
turtle.turnLeft() turtle.turnLeft()
print('Heading back to chest.')
for i = 1, (3 * NUM_OF_TREES) do for i = 1, (3 * NUM_OF_TREES) do
check_fuel() modules.check_fuel()
if i ~= 3 * NUM_OF_TREES then if i ~= 3 * NUM_OF_TREES then
turtle.dig() turtle.dig()
end end
turtle.foward() turtle.forward()
end end
end end