AdvancedPeripherals
AdvancedPeripherals copied to clipboard
[Suggestion] Simple Distance Sensor
Describe your idea
Would be nice to have some sort of simple distance sensor that would output the distance between it and a block in front of it in a straight line.
Possible deployments:
- Detect where a Create Mod elevator cabin stops in a shaft to confirm/calibrate the positioning of the lift
- Detect an entity or intruder in an area by checking for a change in distance (could be done with tripwire hooks, but is less clean and technically takes up more space)
Possible methods/functions exposed to the programmer:
-
setLaserVisible(boolean)enables a visible laser (default off) -
getLaserVisible()returnstrueif the laser is set to visible, elsefalse -
setDetectTransparent(boolean)would make it detect transparent blocks (default off) -
getDetectTransparent()returnstrueif it is set to detect transparent blocks, elsefalse -
setHeightMode(value)sets avaluethat determines which height the sensor's laser is emitted from.- This could be a predetermined number of modes like
1is low,2is center, and3is high, - Or it could be a value between
0.0625and0.9375(basically aligning with the 16x16 textures) and round to the nearest1/16th (in-range) -- I'd propose naming itsetHeight()instead
- This could be a predetermined number of modes like
-
getHeightMode()Returns a value corresponding to the configured height mode (name thisgetHeight()instead if it's not predetermined modes) -
getDistance()would return the distance (in blocks/metres) of the detected block or entity. Returns-1if nothing is detected in range.
If the sensor does not detect something as it's out of range, then it should probably return a value of -1.
For what would you need the height? For something like slabs?
For what would you need the height? For something like slabs?
Yeah, just some way to adjust for low-obstacles like slabs could be useful. Not really necessary, but would be a nice thing to have if you need it.