feat: add configurable trash droppers and discard interval for stock management

This commit is contained in:
MayaTheShy
2026-03-25 17:46:58 -04:00
parent 22836dafb2
commit 2d2b8835b1

View File

@@ -53,6 +53,17 @@ C.COMPOST_RESERVE = 128
C.COMPOST_DROPPER = "minecraft:dropper_10"
C.COMPOST_HOPPER = "minecraft:hopper_0"
-- Stock limits / auto-discard (overridable via config file)
C.TRASH_DROPPERS = { -- droppers facing lava/void for destroying excess items
"minecraft:dropper_11",
"minecraft:dropper_12",
"minecraft:dropper_13",
"minecraft:dropper_14",
"minecraft:dropper_15",
"minecraft:dropper_16",
}
C.DISCARD_INTERVAL = 5 -- seconds between discard checks
-- Peripheral
C.PERIPHERAL_CACHE_TTL = 5
@@ -113,6 +124,13 @@ function C.loadConfig()
if cfg.compostReserve then C.COMPOST_RESERVE = cfg.compostReserve end
if cfg.compostDropper then C.COMPOST_DROPPER = cfg.compostDropper end
if cfg.compostHopper then C.COMPOST_HOPPER = cfg.compostHopper end
if cfg.trashDroppers then C.TRASH_DROPPERS = cfg.trashDroppers end
if cfg.discardInterval then C.DISCARD_INTERVAL = cfg.discardInterval end
if cfg.stockLimits then
for item, limit in pairs(cfg.stockLimits) do
C.STOCK_LIMITS[item] = limit -- merge / override per-item
end
end
if cfg.parallelScanChunks then C.PARALLEL_SCAN_CHUNKS = cfg.parallelScanChunks end
if cfg.chestPriority then C.CHEST_PRIORITY = cfg.chestPriority end
if cfg.supplyChest then C.SUPPLY_CHEST = cfg.supplyChest end
@@ -130,6 +148,7 @@ C.FUEL_LIST = dofile(_path("data/fuel.lua"))
local _compostData = dofile(_path("data/compostable.lua"))
C.COMPOSTABLE = _compostData.items
C.COMPOST_TRASH = _compostData.trash
C.STOCK_LIMITS = dofile(_path("data/stock_limits.lua"))
C.LOW_STOCK_ALERTS = dofile(_path("data/alerts.lua"))
-- Recipe book: merges built-in recipes + user-learned recipes
@@ -184,6 +203,10 @@ for _, f in ipairs(C.FUEL_LIST) do C.FUEL_SET[f.name] = true end
C.COMPOSTABLE_SET = {}
for _, name in ipairs(C.COMPOSTABLE) do C.COMPOSTABLE_SET[name] = true end
-- Build stock limits set for quick lookup
C.STOCK_LIMITS_SET = {}
for name, _ in pairs(C.STOCK_LIMITS) do C.STOCK_LIMITS_SET[name] = true end
return C
end