-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from cyberbit/feature/miscadapters
Add Powah, Bigger Reactors, and Advanced Peripherals adapters
- Loading branch information
Showing
23 changed files
with
889 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 3 additions & 22 deletions
25
src/telem/lib/input/advancedPeripherals/EnergyDetectorInputAdapter.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/telem/lib/input/advancedPeripherals/EnvironmentDetectorInputAdapter.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
local fn = require 'telem.vendor'.fluent.fn | ||
|
||
local base = require 'telem.lib.input.advancedPeripherals.BaseAdvancedPeripheralsInputAdapter' | ||
|
||
local EnvironmentDetectorInputAdapter = base.mintAdapter('EnvironmentDetectorInputAdapter') | ||
|
||
function EnvironmentDetectorInputAdapter:beforeRegister (peripheralName, categories) | ||
self.prefix = 'apenv:' | ||
|
||
self.queries = { | ||
basic = { | ||
block_light_level = fn():call('getBlockLightLevel'), | ||
day_light_level = fn():call('getDayLightLevel'), | ||
sky_light_level = fn():call('getSkyLightLevel'), | ||
moon_id = fn():call('getMoonId'), | ||
time = fn():call('getTime'), | ||
radiation = fn():call('getRadiationRaw'):with('unit', 'Sv/h'), | ||
can_sleep = fn():call('canSleepHere'):toFlag(), | ||
raining = fn():call('isRaining'):toFlag(), | ||
sunny = fn():call('isSunny'):toFlag(), | ||
thundering = fn():call('isThunder'):toFlag(), | ||
slime_chunk = fn():call('isSlimeChunk'):toFlag(), | ||
}, | ||
} | ||
|
||
-- getBiome | ||
-- getDimensionName | ||
-- getDimensionPaN | ||
-- getDimensionProvider | ||
-- getMoonName | ||
-- getOperationCooldown | ||
-- isDimension | ||
-- listDimensions | ||
-- scanCost | ||
-- scanEntities | ||
end | ||
|
||
return EnvironmentDetectorInputAdapter |
24 changes: 24 additions & 0 deletions
24
src/telem/lib/input/advancedPeripherals/GeoScannerInputAdapter.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
local fn = require 'telem.vendor'.fluent.fn | ||
|
||
local base = require 'telem.lib.input.advancedPeripherals.BaseAdvancedPeripheralsInputAdapter' | ||
local Metric = require 'telem.lib.Metric' | ||
|
||
local GeoScannerInputAdapter = base.mintAdapter('GeoScannerInputAdapter') | ||
|
||
function GeoScannerInputAdapter:beforeRegister (peripheralName, categories) | ||
self.prefix = 'apgeo:' | ||
|
||
self.queries = { | ||
basic = {}, | ||
} | ||
|
||
self.storageQueries = { | ||
fn():callElse('chunkAnalyze', {}) | ||
:map(function (k, v) return Metric{ name = k, value = v } end) | ||
:values() | ||
} | ||
|
||
-- scan | ||
end | ||
|
||
return GeoScannerInputAdapter |
33 changes: 33 additions & 0 deletions
33
src/telem/lib/input/advancedPeripherals/InventoryManagerInputAdapter.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
local fn = require 'telem.vendor'.fluent.fn | ||
|
||
local base = require 'telem.lib.input.advancedPeripherals.BaseAdvancedPeripheralsInputAdapter' | ||
local Metric = require 'telem.lib.Metric' | ||
|
||
local InventoryManagerInputAdapter = base.mintAdapter('InventoryManagerInputAdapter') | ||
|
||
function InventoryManagerInputAdapter:beforeRegister (peripheralName, categories) | ||
self.prefix = 'apinv:' | ||
|
||
local armor = fn():call('getArmor') | ||
|
||
self.queries = { | ||
basic = { | ||
equipped = fn():call('isPlayerEquipped'):toFlag(), | ||
equipped_helmet = armor:firstWhere('slot', 103):toFlag(), | ||
equipped_chestplate = armor:firstWhere('slot', 102):toFlag(), | ||
equipped_leggings = armor:firstWhere('slot', 101):toFlag(), | ||
equipped_boots = armor:firstWhere('slot', 100):toFlag(), | ||
inventory_available = fn():call('isSpaceAvailable'):toFlag(), | ||
inventory_slots_available = fn():call('getEmptySpace'), | ||
}, | ||
} | ||
|
||
self.storageQueries = { | ||
fn():call('getItems') | ||
:sum('count', 'name') | ||
:map(function (k, v) return Metric{ name = k, value = v, unit = 'item' } end) | ||
:values() | ||
} | ||
end | ||
|
||
return InventoryManagerInputAdapter |
Oops, something went wrong.