I encountered a bug where a rectangular 2x3 entity was affected by a beacon that was out of range of it. I looked at the source code and discovered that you're using prototype.selection_box to calculate the bounding box of each entity. This won't work if the entity is rotated. Instead, you should use the entity's selection_box, which automatically takes care of the entity's position, dimensions, and rotation.