mcrfpy.Entity __repr__ lies #217

Closed
opened 2026-01-15 03:28:37 +00:00 by john · 0 comments
Owner
>>> e2
<Entity (grid_x=0, grid_y=0, sprite_index=0)>
>>> e2.pos
<Vector (5, 5)>

More associated weirdness. Why does an entity have to be associated with a grid to have its position assigned?

.pos is not accessible when not on a grid - can't be read or written. But the same position is applied when the entity is added to another grid, or back to the same. Position is a property on the entity... ...yet it's only accessible if the entity is on a grid.

Nominally, a position would be a property of the relationship between Entity and Grid. When removed from a grid, they'd truly be positionless. To be added to a grid, EntityCollection would also require a position value. But that's enormously complicated. Is this "can't access your own position element" really a good fit?

``` >>> e2 <Entity (grid_x=0, grid_y=0, sprite_index=0)> >>> e2.pos <Vector (5, 5)> ``` More associated weirdness. Why does an entity have to be associated with a grid to have its position assigned? `.pos` is not accessible when not on a grid - can't be read or written. But the same position is applied when the entity is added to another grid, or back to the same. Position is a property on the entity... ...yet it's only accessible if the entity is on a grid. Nominally, a position would be a property of the relationship between Entity and Grid. When removed from a grid, they'd truly be positionless. To be added to a grid, EntityCollection would also require a position value. But that's enormously complicated. Is this "can't access your own position element" really a good fit?
john closed this issue 2026-01-17 00:22:22 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
john/McRogueFace#217
No description provided.