Fix issue 1 (#5)

See #1

Co-authored-by: Anton Reinhard <s1509337@msx.tu-dresden.de>
Reviewed-on: Rubydragon/fusion-speedrun#5
This commit is contained in:
Anton Reinhard 2023-09-30 13:54:43 +02:00
parent c66736cf44
commit 5bd13b022e

View File

@ -341,19 +341,30 @@ function returnItems()
faceTo(-1, 0)
local droppedAll = true
while true do
droppedAll = true
-- already facing right direction, put items
for slot = 1, maxCompareSlot do
-- put away compare slots' items except one
turtle.select(slot)
turtle.drop(turtle.getItemCount(slot) - 1)
if (turtle.getItemCount(slot) ~= 1) then
droppedAll = false
end
end
for slot = maxCompareSlot + 1, 16 do
-- then drop everything else
if (turtle.getItemCount(slot) == 0) then
break
end
turtle.select(slot)
turtle.drop()
if (turtle.getItemCount(slot) ~= 0) then
droppedAll = false
end
end
if (droppedAll) then
break
end
end
-- necessary so the next mined block doesn't go in random places