diff --git a/src/backend.lua b/src/backend.lua index 1a3471f..2999504 100644 --- a/src/backend.lua +++ b/src/backend.lua @@ -141,8 +141,7 @@ logger:info("Dispensing " .. amount .. "x " .. product.id .. " (s).") - local stackSize = storage.getItem(product.id) - print(textutils.serialise(stackSize)) + local stackSize = storage.getItem(product.id).item.maxCount local turns = math.ceil(amount / stackSize / 16) local lastTurn = amount - ((turns - 1) * stackSize * 16) diff --git a/src/frontend.lua b/src/frontend.lua index 72e35b3..f977e6d 100644 --- a/src/frontend.lua +++ b/src/frontend.lua @@ -2,7 +2,6 @@ local basalt = require("libs/basalt") local storage = ctx.storage -storage.refreshStorage(true) local function searchObject(base, id) local obj = base:getObject(id) @@ -106,7 +105,7 @@ -- Events basalt.onEvent(function(event) if event == "kstUpdateProducts" then - storage.refreshStorage() + storage.refreshStorage(true) local body = searchObject(base, "_body") -- Clear repeat