fix(coal-crafter): storage inventory should be on the back side

This commit is contained in:
Guillaume ARM 2024-05-20 01:35:38 +02:00
parent 115ffd2e78
commit 084b6d941f

View File

@ -42,16 +42,33 @@ local function craft()
end end
local functin dropSelected() local functin dropSelected()
turtle.turnLeft()
turtle.turnLeft() turtle.turnLeft()
turtle.drop() turtle.drop()
turtle.turnRight() turtle.turnRight()
turtle.turnRight()
end
local function findBufferChestOrientation()
for i=1, 3, 1 do
local inv = turtleUtils.getInventory('front')
if inv and #inv.list() == 0 then
return
end
turtle.turnRight()
end
error('buffer inventory not found (empty chest expected)')
end end
local function main() local function main()
turtle.select(1) turtle.select(1)
findBufferChestOrientation()
print('> Waiting for left inventory (storage)') print('> Waiting for left inventory (storage)')
local storageInventory = turtleUtils.waitForInventory('left', WAIT_INVENTORY_TIME) local storageInventory = turtleUtils.waitForInventory('back', WAIT_INVENTORY_TIME)
print('> Waiting for the front inventory (buffer chest)') print('> Waiting for the front inventory (buffer chest)')
local bufferInventory = turtleUtils.waitForInventory('front', WAIT_INVENTORY_TIME) local bufferInventory = turtleUtils.waitForInventory('front', WAIT_INVENTORY_TIME)
@ -59,7 +76,7 @@ local function main()
print('> coal-crafter process started') print('> coal-crafter process started')
while true do while true do
storageInventory = turtleUtils.waitForInventory('left', WAIT_INVENTORY_TIME) storageInventory = turtleUtils.waitForInventory('back', WAIT_INVENTORY_TIME)
bufferInventory = turtleUtils.waitForInventory('front', WAIT_INVENTORY_TIME) bufferInventory = turtleUtils.waitForInventory('front', WAIT_INVENTORY_TIME)
local coalEssenceSlot = waitForCoalEssence(storageInventory) local coalEssenceSlot = waitForCoalEssence(storageInventory)