File tree Expand file tree Collapse file tree
src/telem/modules/advancedPeripherals Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,12 +8,14 @@ return function (api)
88 function MEBridgeInputAdapter :beforeRegister (peripheralName , categories )
99 self .prefix = ' apmebridge:'
1010
11+ local _ , component = next (self .components )
12+ local listCellsSupported = pcall (component .listCells ) and true or false
13+
1114 self .queries = {
1215 basic = {
1316 energy_usage = fn ():call (' getEnergyUsage' ):aeToFe ():energyRate (),
1417 item_storage_used = fn ():call (' getUsedItemStorage' ):with (' unit' , ' bytes' ),
1518 fluid_storage_used = fn ():call (' getUsedFluidStorage' ):with (' unit' , ' bytes' ),
16- cell_count = fn ():call (' listCells' ):count (),
1719 },
1820 energy = {
1921 energy = fn ():call (' getEnergyStorage' ):aeToFe ():energy (),
@@ -27,6 +29,13 @@ return function (api)
2729 },
2830 }
2931
32+ if listCellsSupported then
33+ self .queries .basic .cell_count = fn ():call (' listCells' ):count ()
34+ else
35+ -- TODO debug logs aren't supported in adapter constructors yet
36+ self :dlog (' MEBridgeInput:beforeRegister :: cell_count is not supported on this network, upgrade to Advanced Peripherals 0.7.41r or newer' )
37+ end
38+
3039 -- TODO gas storage metrics?
3140
3241 -- getCraftingCPUs
You can’t perform that action at this time.
0 commit comments