diff --git a/inventoryManager.lua b/inventoryManager.lua index 58c25f8..d126d6f 100644 --- a/inventoryManager.lua +++ b/inventoryManager.lua @@ -645,6 +645,7 @@ local cache = { barrelOk = false, furnaceCount = 0, furnaceStatus = {}, -- per-furnace { name, type, input, fuel, output, active } + droppers = {}, -- list of available dropper peripherals for dispensing } ------------------------------------------------- @@ -895,6 +896,21 @@ local function refreshCache(onProgress) cache.dropperOk = peripheral.wrap(DROPPER_NAME) ~= nil cache.barrelOk = peripheral.wrap(BARREL_NAME) ~= nil + -- Discover all droppers on the network (for location-based dispensing) + local droppers = {} + for _, name in ipairs(peripheral.getNames()) do + if peripheral.getType(name) == "minecraft:dropper" and name ~= COMPOST_DROPPER then + local isDefault = (name == DROPPER_NAME) + table.insert(droppers, { name = name, isDefault = isDefault }) + end + end + -- Sort so default dropper comes first + table.sort(droppers, function(a, b) + if a.isDefault ~= b.isDefault then return a.isDefault end + return a.name < b.name + end) + cache.droppers = droppers + -- Furnace count already computed from single-pass above cache.furnaceCount = #furnaces @@ -2937,6 +2953,7 @@ local function broadcastState() barrelOk = cache.barrelOk, furnaceCount = cache.furnaceCount, furnaceStatus = cache.furnaceStatus, + droppers = cache.droppers, }, activity = activity, alerts = activeAlerts,