diff --git a/coal-crafter.lua b/coal-crafter.lua index a58dc92..61056fa 100644 --- a/coal-crafter.lua +++ b/coal-crafter.lua @@ -42,16 +42,33 @@ local function craft() end local functin dropSelected() + turtle.turnLeft() turtle.turnLeft() turtle.drop() 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 local function main() turtle.select(1) + findBufferChestOrientation() + 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)') local bufferInventory = turtleUtils.waitForInventory('front', WAIT_INVENTORY_TIME) @@ -59,7 +76,7 @@ local function main() print('> coal-crafter process started') while true do - storageInventory = turtleUtils.waitForInventory('left', WAIT_INVENTORY_TIME) + storageInventory = turtleUtils.waitForInventory('back', WAIT_INVENTORY_TIME) bufferInventory = turtleUtils.waitForInventory('front', WAIT_INVENTORY_TIME) local coalEssenceSlot = waitForCoalEssence(storageInventory)