From 0c33acf06d57e0e98ab97647f8f876b837efba2a Mon Sep 17 00:00:00 2001 From: Max <33982882+maxboeer@users.noreply.github.com> Date: Mon, 1 Jun 2026 14:57:40 +0200 Subject: [PATCH] Mebride compatibility fix --- compcount.lua | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/compcount.lua b/compcount.lua index 4d4d645..911460d 100644 --- a/compcount.lua +++ b/compcount.lua @@ -26,7 +26,23 @@ local mf = require("morefonts-pe") local frame = Pine3D.newFrame() frame:setBackgroundColor(colors.black) -local meSystem = peripheral.find("meBridge") or peripheral.find("rsBridge") + +local function findStorageBridge() + return peripheral.find("meBridge") + or peripheral.find("me_bridge") + or peripheral.find("rsBridge") + or peripheral.find("rs_bridge") +end + +local meSystem = findStorageBridge() + +local function ensureStorageBridge() + if not meSystem then + meSystem = findStorageBridge() + end + + return meSystem +end local chainItemsByBaseId local baseItemIds @@ -239,12 +255,14 @@ local function getItemIcon(item) end local function getMeItemCount(itemId) - if not meSystem or not itemId then + local bridge = ensureStorageBridge() + + if not bridge or not itemId then return 0 end - if type(meSystem.getItem) == "function" then - local ok, item = pcall(meSystem.getItem, { name = itemId }) + if type(bridge.getItem) == "function" then + local ok, item = pcall(bridge.getItem, { name = itemId }) if ok and item then return tonumber(item.amount or item.count or item.qty) or 0 end @@ -260,7 +278,9 @@ local function getMeItemCounts(itemIds) counts[itemIds[i]] = 0 end - if not meSystem then + local bridge = ensureStorageBridge() + + if not bridge then return counts end @@ -282,7 +302,7 @@ local function getMeItemCounts(itemIds) return counts end - local listItems = meSystem.listItems or meSystem.getItems or meSystem.listAvailableItems + local listItems = bridge.listItems or bridge.getItems or bridge.listAvailableItems if not listItems then return counts end