diff --git a/Krypton b/Krypton index 2f5557c..4ec7ee9 160000 --- a/Krypton +++ b/Krypton @@ -1 +1 @@ -Subproject commit 2f5557ccbac59b263c5af7394a0d236d43f4fddd +Subproject commit 4ec7ee90160a1383e18dccdfee3d96918ec52f6e diff --git a/core/inventory/ScanInventory.lua b/core/inventory/ScanInventory.lua index 365f326..1f04ed5 100644 --- a/core/inventory/ScanInventory.lua +++ b/core/inventory/ScanInventory.lua @@ -96,7 +96,7 @@ end local function predicateMatches(predicates, item) - local meta = peripheral.call(item.inventory, "getItemMeta", item.slot) + local meta = peripheral.call(item.inventory, "getItemDetail", item.slot) return partialObjectMatches(predicates, meta) end @@ -147,7 +147,7 @@ local inventory = item.inventory local slot = item.slot if cached or item.name == product.modid then - item = peripheral.call(inventory, "getItemMeta", slot) + item = peripheral.call(inventory, "getItemDetail", slot) if item then if item.name ~= product.modid or (product.predicates and not partialObjectMatches(product.predicates, item)) then item = nil diff --git a/modules/display.lua b/modules/display.lua index cf37a89..041faee 100644 --- a/modules/display.lua +++ b/modules/display.lua @@ -34,7 +34,10 @@ local TextCanvas = canvases.TextCanvas - self.mon = peripheral.find("monitor") + self.mon = peripheral.wrap(props.peripherals.monitor) + if not self.mon then + self.mon = peripheral.find("monitor") + end if not self.mon then self.mon = term else diff --git a/radon.lua b/radon.lua index 11e91d2..8846c93 100644 --- a/radon.lua +++ b/radon.lua @@ -30,6 +30,10 @@ ConfigValidator.validateConfig(config) ConfigValidator.validateProducts(products) +if config.peripherals.outputChest == "self" and not config.peripherals.self then + error("Output chest is set to self, but no self peripheral name is set") +end + local display = Display.new({theme=config.theme}) local function getDisplayedProducts(allProducts, settings) @@ -105,7 +109,7 @@ } if props.shopState.selectedCurrency then - local footer = SmolText { display=display, text="/pay @" .. props.shopState.selectedCurrency.name .. " ", 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 } + local footer = SmolText { display=display, text="/pay @" .. props.shopState.selectedCurrency.name .. " ", 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 } table.insert(flatCanvas, footer) end @@ -353,7 +357,7 @@ local t2 = os.epoch("utc") -- print("Render time: " .. (t2-t1) .. "ms") - local e = { os.pullEvent() } + local e = { os.pullEventRaw() } local name = e[1] if name == "timer" and e[2] == deltaTimer then local clock = os.epoch("utc") @@ -373,9 +377,18 @@ if e[2] == keys.q then break end + elseif name == "terminate" then + display.mon.clear() + break end end -- Profiler:deactivate() end) +for i = 1, #config.currencies do + local currency = config.currencies[i] + currency.krypton.ws.disconnect() +end + +print("Radon terminated, goodbye!") -- Profiler:write_results(nil, "profile.txt")