Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/telem/lib/input/advancedPeripherals/MEBridgeInputAdapter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ local MEBridgeInputAdapter = base.mintAdapter('MEBridgeInputAdapter')
function MEBridgeInputAdapter:beforeRegister (peripheralName, categories)
self.prefix = 'apmebridge:'

local _, component = next(self.components)
local listCellsSupported = pcall(component.listCells) and true or false

self.queries = {
basic = {
energy_usage = fn():call('getEnergyUsage'):aeToFe():energyRate(),
item_storage_used = fn():call('getUsedItemStorage'):with('unit', 'bytes'),
fluid_storage_used = fn():call('getUsedFluidStorage'):with('unit', 'bytes'),
cell_count = fn():call('listCells'):count(),
},
energy = {
energy = fn():call('getEnergyStorage'):aeToFe():energy(),
Expand All @@ -27,6 +29,13 @@ function MEBridgeInputAdapter:beforeRegister (peripheralName, categories)
},
}

if listCellsSupported then
self.queries.basic.cell_count = fn():call('listCells'):count()
else
-- TODO debug logs aren't supported in adapter constructors yet
self:dlog('MEBridgeInput:beforeRegister :: cell_count is not supported on this network, upgrade to Advanced Peripherals 0.7.41r or newer')
end

-- TODO gas storage metrics?

-- getCraftingCPUs
Expand Down
Loading