From ba8376e42ebe52448a188afdc8286c06316d2234 Mon Sep 17 00:00:00 2001 From: jiriks74 Date: Thu, 17 Oct 2024 21:19:24 +0200 Subject: [PATCH] fix: Remove delay after successfully moving an item --- main.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.lua b/main.lua index ffd4181..cc2c883 100644 --- a/main.lua +++ b/main.lua @@ -84,7 +84,6 @@ function loadIndex() local itemIndex local db = fs.open(settings.get("ccVault.file"), "r") if not db then - -- printError("Couldn't open DB file!\n" .. settings.get("ccVault.file")) print("Index file not found. It probably wasn't created yet.") local iCount = 0 write("Waiting until indexing is finished") @@ -128,7 +127,6 @@ function storageLoop() item = nil count = nil end - sleep(2) term.clear() term.setCursorPos(1, 1) end @@ -146,18 +144,22 @@ function transfer(tItem, maxCount, itemIndex) end if not exists then print("Item not found.\nTry to wait for index update.") + sleep(3) return end local sItemInfo = peripheral.call(itemIndex[tItem][1]["chest"], "getItemDetail", itemIndex[tItem][1]["slot"]) if not sItemInfo then print("Index is out of date!\nWait for index update to resolve this error.") + sleep(3) return elseif sItemInfo.count <= 0 then print("Index is out of date!\nWait for index update to resolve this error.") + sleep(3) return elseif not sItemInfo.count then print("Index is out of date!\nWait for index update to resolve this error.") + sleep(3) return end @@ -165,6 +167,7 @@ function transfer(tItem, maxCount, itemIndex) if not itemIndex[tItem][1] then if transfered > 0 then print("Not enough of `" .. tItem .. "` was found.\nTransfered only " .. transfered .. ".") + sleep(3) end break end @@ -174,6 +177,7 @@ function transfer(tItem, maxCount, itemIndex) if lastSlot then if lastSlot.count > 0 then print("Output inventory is full!") + sleep(3) return end end @@ -188,12 +192,14 @@ function transfer(tItem, maxCount, itemIndex) elseif moved == 0 then if peripheral.call(settings.get("ccVault.outputInventory"), "size") == transfered then print("Output inventory is full!") + sleep(3) break else table.remove(itemIndex[tItem], 1) end elseif not moved then print("Item not found!") + sleep(3) break else transfered = transfered + moved