feat(coal-creafter): dropAll at start
This commit is contained in:
parent
802c8e2a43
commit
6a50fef10a
@ -14,6 +14,20 @@ local STORAGE_INVENTORY_SIDE = 'front'
|
||||
local dropInStorageFn = turtle.drop
|
||||
local suckFromBufferFn = turtle.suckDown
|
||||
|
||||
local function dropAll(side, dropFn)
|
||||
for i=1, 16, 1 do
|
||||
local count = turtle.getItemCount(i)
|
||||
|
||||
if count > 0 then
|
||||
turtleUtils.waitForInventory(side, IDLE_TIME)
|
||||
|
||||
if not turtleUtils.dropSlot(i, dropFn) then
|
||||
error('please empty the turtle inventory', 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function countCoalItems(inventory)
|
||||
local total = 0
|
||||
|
||||
@ -112,6 +126,9 @@ local function main()
|
||||
print('> Waiting for the front inventory (buffer chest)')
|
||||
local bufferInventory = turtleUtils.waitForInventory(STORAGE_BUFFER_SIDE, WAIT_INVENTORY_TIME)
|
||||
|
||||
print('> drop all')
|
||||
dropAll(STORAGE_INVENTORY_SIDE, dropInStorageFn)
|
||||
|
||||
print('> coal-crafter process started')
|
||||
|
||||
while true do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user