[boskid][2.0.23] Entity prototypes are missing "layers" information, leading to collision_mask_util.masks_collide crash
Posted: Sat Nov 30, 2024 1:12 am
I have a prototype definition for an entity that contains a collision mask. The collision mask has an empty "layers" definition:
Note that the prototype does define layers as empty (it can not be omitted; more about that in a second).
Now when I create an entity using LuaSurface::create_entity, this is what I receive:
The prototype for this entity does NOT contain the layer information. I want to use collision_mask_util.masks_collide from the lualib to check whether any of these entities collides with others and that crashes my mod because the function assumes that any collision mask *does* contain a "layers" attribute.
Either any entity created by the game should contain the layers attribute even if it is empty (do not omit when there is no layer defined) *OR* the lualib needs to be tolerant of the layers attribute missing. The current state seems to be a bug.
Note that the prototype does define layers as empty (it can not be omitted; more about that in a second).
Now when I create an entity using LuaSurface::create_entity, this is what I receive:
The prototype for this entity does NOT contain the layer information. I want to use collision_mask_util.masks_collide from the lualib to check whether any of these entities collides with others and that crashes my mod because the function assumes that any collision mask *does* contain a "layers" attribute.
Either any entity created by the game should contain the layers attribute even if it is empty (do not omit when there is no layer defined) *OR* the lualib needs to be tolerant of the layers attribute missing. The current state seems to be a bug.