I'm trying to figure the sonic sensor card out. However i have some trouble to get the result that I would expect.
To try to explain the problems i have done some test, which are shown here:
Test 1:
I am wondering why the 3 blocks in front(+X) of the turtle are reported as unknown. Seems like a bug, since that a block will only report as unknown if there is no block at +X.
Test 2:
Everything looks OK. This implies that it is correct that the sensor shouldn't be able to scan blocks where the vector from the turtle to the block is blocked by another block. However if I do the same test with the blocks either one level above or under the turtle(i.e. y=1 or y=-1) the result is the same. E.g. block at (0,1,2) cannot be detected, when there is a block at (0,1,1), even though there is no block at (0,0,1) or (0,0,2). In this case there is no block blocking the vector between the turtle and the scanned block.
Test 3:
Some blocks are reported as unknown. I guess the reason for this is the same as in "Test 1". Another thing is the corners. The -X corners cannot be scanned while the +X corners can.
Test 4:
The liquid seems to be misplaced 1 block out of the negative x axis.
In general:
I like the idea that you cannot scan blocks where the vector between the turtle and the block is blocked by another block, however this doesn't seem to work correctly. Another problem with this is that, the only way i can detect if a scanned block is air or if it could not be scanned, is to figure out for my self if there is another blocking the path between the turtle and the scanned block. This could be solved by returning a block of "Type" AIR, when the block could be scanned and only contains air.
Another thing is the coordinates returned together with the block type. They are always -1 X off, compared to the coordinates given in the scan request. What is the reason for this?
Edit:
After looking at the source code for the sonicSensor.java, i see that i looks like that you ment to be able to query any block within the sensor range. So is it a bug that you cannot detect a block at (0,0,2) if there is a block at (0,0,1)?
Another thing i noticed, is that getTargets() is implemented in the java code. This does not work when called from lua. Thought this was as it was ment to be, but now i think it is a bug?













