Advanced Peripherals Player Detector Input Source
lua
telem.input.advancedPeripherals.playerDetector (
peripheralID: string,
categories?: string[] | '*',
playerName?: string
)Mod Dependencies
Requires Advanced Peripherals.
See the Usage section for a complete list of the metrics in each category.
| Name | Type | Default |
|---|---|---|
peripheralID | string | nil |
| Peripheral ID of the Player Detector | ||
categories | string[] | "*" | { "basic" } |
List of metric categories to query. The value lua | ||
playerName | string | nil |
| Name of the player to query for additional metrics | ||
Usage
lua
local telem = require 'telem'
local backplane = telem.backplane()
:addInput(
'my_playerDetector',
telem.input.advancedPeripherals.playerDetector('right', '*', 'PlayerName')
)
:cycleEvery(5)()Given a Player Detector peripheral on the right side of the computer, this appends the following metrics to the backplane (grouped by category here for clarity):
Basic
| Name | Value | Unit |
|---|---|---|
applayer:online_player_count | 0 - inf |
Player
If playerName is provided, the following additional metrics are appended to the backplane, tracking the specified player's status:
| Name | Value | Unit |
|---|---|---|
applayer:player_eye_height | 0 - inf | m |
applayer:player_pitch | -90 - 90 | ° |
applayer:player_yaw | -180 - 180 | ° |
applayer:player_health | 0 - inf | |
applayer:player_air_supply | 0 - inf | |
applayer:player_max_health | 0 - inf |