Sensor Module
The Sensor module allows the user to control Sensor blocks on the grid. We can use hooks to trigger actions when an entity is detected or not detected by the sensor.
Hooks
The following hooks can be define in the block's Custom Data, and will be triggered when the corresponding command is called:
Key | Trigger |
---|---|
onDetect | Run when a Sensor block detects an entity. |
onClear | Run when a Sensor block does not detect an entity. |
Example
Imagine our Sensor has a status light we want to view elsewhere:
[hooks]
onDetect=light/blink "Landing Pad Light" fast;
onClear=light/blink "Landing Pad Light" off;
or
[hooks]
LandingPadSensor.onDetect=light/blink "Landing Pad Light" fast;
"Airlock Sensor".onClear=door/close AirlockInnerDoor;
Note
Sensors can read details about the entity they are detecting. I hope to leverage this in future features related to docking and collision avoidance.