Enhance autoSmelt function by adding cache adjustments for item movements
This commit is contained in:
@@ -2201,6 +2201,7 @@ local function autoSmelt()
|
||||
for _, chest in ipairs(chests) do
|
||||
local n = furnace.pushItems(chest, SLOT_OUTPUT)
|
||||
if n and n > 0 then
|
||||
adjustCache(outputItem.name, chest, n)
|
||||
remaining = remaining - n
|
||||
print(string.format("[SMELT] Output %s x%d -> %s",
|
||||
outputItem.name, n, chest))
|
||||
@@ -2221,6 +2222,7 @@ local function autoSmelt()
|
||||
for _, chest in ipairs(chests) do
|
||||
local n = furnace.pushItems(chest, slot)
|
||||
if n and n > 0 then
|
||||
adjustCache(item.name, chest, n)
|
||||
print(string.format("[SMELT] Extra slot %d: %s x%d -> %s",
|
||||
slot, item.name, n, chest))
|
||||
didWork = true
|
||||
@@ -2252,6 +2254,7 @@ local function autoSmelt()
|
||||
for _, chest in ipairs(chests) do
|
||||
local n = furnace.pushItems(chest, SLOT_INPUT)
|
||||
if n and n > 0 then
|
||||
adjustCache(inputItem.name, chest, n)
|
||||
print(string.format("[SMELT] Removed incompatible %s x%d from %s -> %s",
|
||||
inputItem.name, n, fname, chest))
|
||||
didWork = true
|
||||
@@ -2278,6 +2281,7 @@ local function autoSmelt()
|
||||
local toMove = math.min(16, slotItem.count)
|
||||
local n = chest.pushItems(fname, slot, toMove, SLOT_FUEL)
|
||||
if n and n > 0 then
|
||||
adjustCache(fuel.name, source.chest, -n)
|
||||
print(string.format("[SMELT] Fuel %s x%d -> %s",
|
||||
fuel.name, n, fname))
|
||||
didWork = true
|
||||
@@ -2347,6 +2351,7 @@ local function autoSmelt()
|
||||
local toMove = math.min(slotItem.count, remaining)
|
||||
local n = chest.pushItems(fname, slot, toMove, SLOT_INPUT)
|
||||
if n and n > 0 then
|
||||
adjustCache(itemName, source.chest, -n)
|
||||
print(string.format("[SMELT] Input %s x%d -> %s (reserve %d)",
|
||||
itemName, n, fname, math.max(0, totalInStorage - n)))
|
||||
didWork = true
|
||||
|
||||
Reference in New Issue
Block a user