Motion Sensor: Difference between revisions
Jump to navigation
Jump to search
Experimental unified version of Motion Sensor, combining the separate block info and component API into a single page. |
m Try different heading types |
||
| Line 1: | Line 1: | ||
[[File:motion_sensor.png|128px]] | [[File:motion_sensor.png|128px]] | ||
| Line 14: | Line 12: | ||
[[File:motionsensor.png|200px]] | [[File:motionsensor.png|200px]] | ||
= Component API = | |||
When an entity within line of sight of the Motion Sensor moves faster than the threshold a [[Component/signals#motion_sensor_block|motion]] event is queued. The sensor has a radius limit of 8 and is updated every half second. | When an entity within line of sight of the Motion Sensor moves faster than the threshold a [[Component/signals#motion_sensor_block|motion]] event is queued. The sensor has a radius limit of 8 and is updated every half second. | ||
| Line 20: | Line 18: | ||
Component name: <code>motion_sensor</code>. Callbacks: | Component name: <code>motion_sensor</code>. Callbacks: | ||
== getSensitivity == | |||
<code>getSensitivity(): number</code> | <code>getSensitivity(): number</code> | ||
| Line 26: | Line 24: | ||
Gets the current sensitivity of the sensor, i.e. at which speed threshold of distance / second it triggers. | Gets the current sensitivity of the sensor, i.e. at which speed threshold of distance / second it triggers. | ||
== setSentivity == | |||
<code>setSensitivity(value: number): number</code> | |||
Sets the sensor's sensitivity to the specified value, returns the old value. | Sets the sensor's sensitivity to the specified value, returns the old value. | ||
----- | ----- | ||
Revision as of 18:53, 27 August 2026
Allows detecting movement of nearby living entities, as long as a direct line of sight is given. Sensitivity can be configured via its API.
The Motion Sensor is crafted using the following recipe:
- 4 x Gold ingot
- 3 x Daylight Sensor
- 1 x CPU (Tier 2)
- 1 x Printed Circuit Board
Component API
When an entity within line of sight of the Motion Sensor moves faster than the threshold a motion event is queued. The sensor has a radius limit of 8 and is updated every half second.
Component name: motion_sensor. Callbacks:
getSensitivity
getSensitivity(): number
Gets the current sensitivity of the sensor, i.e. at which speed threshold of distance / second it triggers.
setSentivity
setSensitivity(value: number): number
Sets the sensor's sensitivity to the specified value, returns the old value.
