This describes the layers that the object appears in. By default, all bodies are on layer 1.
This describes what layers the body will scan for collisions. If an object isn’t in one of the mask layers, the body will ignore it. By default, all bodies scan layer 1.
As far as I understand, according to the documentation, if you test for collisions, for example using "moveandcollide", the system will report collisions with bodies that are in a collision layer that is in the collision mask of the object we are calling the function on.
However, that is not always true.
Collisions are also detected against an object that happens to be looking for a mask that the object that is checking for collisions is in.
For example, you can have an object that is in no layer, but is testing for the player mask. Then, the player (that of course is in the player mask), is going to collide against that object when executing moveandcollide.
Is this the intended behaviour?
If it is, that's not what I understand from the docs.