diff --git a/DefaultLayout.lua b/DefaultLayout.lua index c566f2c..a43e2b9 100644 --- a/DefaultLayout.lua +++ b/DefaultLayout.lua @@ -99,10 +99,10 @@ footerSize = "small" end if footerSize == "large" then - footer = BigText { display=display, text=footerMessage, x=1, y=display.bgCanvas.height-bigFont.height-6, align=theme.formatting.footerAlign, bg=theme.colors.footerBgColor, color = theme.colors.footerColor, width=display.bgCanvas.width } + footer = BigText { display=display, text=footerMessage, x=1, y=display.bgCanvas.height-bigFont.height-5, align=theme.formatting.footerAlign, bg=theme.colors.footerBgColor, color = theme.colors.footerColor, width=display.bgCanvas.width } footerHeight = smolFont.height + 6 elseif footerSize == "medium" then - footer = SmolText { display=display, text=footerMessage, x=1, y=display.bgCanvas.height-smolFont.height-4, align=theme.formatting.footerAlign, bg=theme.colors.footerBgColor, color = theme.colors.footerColor, width=display.bgCanvas.width } + footer = SmolText { display=display, text=footerMessage, x=1, y=display.bgCanvas.height-smolFont.height-2, align=theme.formatting.footerAlign, bg=theme.colors.footerBgColor, color = theme.colors.footerColor, width=display.bgCanvas.width } footerHeight = smolFont.height + 4 else footer = BasicText { display=display, text=footerMessage, x=1, y=math.floor(display.bgCanvas.height/3), align=theme.formatting.footerAlign, bg=theme.colors.footerBgColor, color = theme.colors.footerColor, width=math.ceil(display.bgCanvas.width/2) } diff --git a/core/inventory/ScanInventory.lua b/core/inventory/ScanInventory.lua index 51a998a..45c9bd4 100644 --- a/core/inventory/ScanInventory.lua +++ b/core/inventory/ScanInventory.lua @@ -43,6 +43,7 @@ local function predicateMatches(predicates, item) local meta = peripheral.call(item.inventory, "getItemDetail", item.slot) + item.cachedMeta = meta return partialObjectMatches(predicates, meta) end @@ -99,6 +100,9 @@ local matchingProducts = findMatchingProducts(products, item) for j = 1, #matchingProducts do local product = matchingProducts[j] + if not product.newQty then + product.newQty = 0 + end product.newQty = product.newQty + item.count end end @@ -114,7 +118,7 @@ table.insert(inventoryThreads, function() local inventoryItems = getInventoryItems(inventory, products) for j = 1, #inventoryItems do - table.insert(items, inventoryItems[i]) + table.insert(items, inventoryItems[j]) end end) end @@ -147,7 +151,7 @@ local item = items[i] local inventory = item.inventory local slot = item.slot - if item.name == product.modid then + if item.name == product.modid and (not cached or not product.predicates or (item.cachedMeta and partialObjectMatches(product.predicates, item.cachedMeta))) then if cached or product.predicates then item = peripheral.call(inventory, "getItemDetail", slot) end diff --git a/radon.lua b/radon.lua index 8db00f4..e247ad4 100644 --- a/radon.lua +++ b/radon.lua @@ -1,4 +1,4 @@ -local version = "1.3.3" +local version = "1.3.5" local configHelpers = require "util.configHelpers" local schemas = require "core.schemas" local oldPullEvent = os.pullEvent @@ -203,6 +203,8 @@ maxScroll = 0, } +local mbsMode = false--fs.exists(".mbs") + local Terminal = Solyd.wrapComponent("Terminal", function(props) local canvas = useCanvas(terminal) local theme = props.configState.config.terminalTheme @@ -210,14 +212,18 @@ local flatCanvas = {} local versionString = "Radon " .. version local terminalCatagories = { "logs", "config", "products" } - local bodyHeight = math.floor(terminal.bgCanvas.height / 3) - 1 + local msOffset = 0 + if mbsMode and multishell.getCount() > 1 then + msOffset = 1 + end + local bodyHeight = math.floor(terminal.bgCanvas.height / 3) - 1 - msOffset local bodyWidth = math.floor(terminal.bgCanvas.width / 2) table.insert(flatCanvas, Rect { key = "header", display = terminal, x = 1, - y = 1, + y = 1 + (msOffset*3), width = terminal.bgCanvas.width, height = 3, color = theme.colors.titleBgColor, @@ -228,7 +234,7 @@ align = "left", text = versionString, x = 1, - y = 1, + y = 1 + msOffset, color = theme.colors.titleTextColor, bg = theme.colors.titleBgColor, }) @@ -245,7 +251,7 @@ align = "center", text = " " .. terminalCatagories[i] .. " ", x = 2 + catagoriesX, - y = 1, + y = 1 + msOffset, color = theme.colors.catagoryTextColor, bg = bgColor, onClick = function() @@ -266,7 +272,7 @@ key = "config-editor", display = terminal, x = 1, - y = 2, + y = 2 + msOffset, width = bodyWidth, height = bodyHeight, config = props.configState.config, @@ -302,7 +308,7 @@ key = "products-editor", display = terminal, x = 1, - y = 2, + y = 2 + msOffset, width = bodyWidth, height = bodyHeight, config = props.shopState.products, @@ -329,7 +335,7 @@ key = "logs", display = terminal, x = 1, - y = 2, + y = 2 + msOffset, width = bodyWidth, height = bodyHeight, logs = props.logs,