UIGrid & UIEntity Integration; reliable add and remove #30

Open
opened 2024-03-09 19:07:19 +00:00 by john · 0 comments
Owner

Notes say:
35 feat: UIEntities should have a .die() method that removes them from their grid; make UIEntity and UIGrid associations airtight (grid add/remove methods, entity add/remove methods, entity transfer to new grid method: Entity always in exactly 1 or 0 grid's collections, entity always has correct grid or None associated)

  • Grid.entities.append(Entity) should set the Entity's Grid pointer to self, and call remove on the previous grid, if the entity has one.
  • Grid.entities.remove(Entity) should work with an entity reference (see #29 for comparable behavior) and a) remove the Entity from the list, b) set the Entity's Grid pointer to None, and c) raise an exception if the entity isn't in the collection.
  • Entity.die() can basically work as self.grid.remove(self), raising an exception if the Entity doesn't already have a Grid

Entities can be disconnected from Grids, but they can't be on more than one.

This might be a prereq for #16

Notes say: 35 feat: UIEntities should have a .die() method that removes them from their grid; make UIEntity and UIGrid associations airtight (grid add/remove methods, entity add/remove methods, entity transfer to new grid method: Entity always in exactly 1 or 0 grid's collections, entity always has correct grid or None associated) * `Grid.entities.append(Entity)` should set the Entity's Grid pointer to `self`, and call `remove` on the previous grid, if the entity has one. * `Grid.entities.remove(Entity)` should work with an entity reference (see #29 for comparable behavior) and a) remove the Entity from the list, b) set the Entity's Grid pointer to `None`, and c) raise an exception if the entity isn't in the collection. * `Entity.die()` can basically work as `self.grid.remove(self)`, raising an exception if the Entity doesn't already have a Grid Entities can be disconnected from Grids, but they can't be on more than one. This might be a prereq for #16
john added the
Major Feature
label 2024-03-09 19:07:19 +00:00
john added this to the All Datatypes Behaving milestone 2024-03-13 14:13:41 +00:00
john added this to the Fun, Convenient McRogueFace Objects project 2024-03-13 14:37:18 +00:00
Sign in to join this conversation.
No Assignees
1 Participants
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#30
No description provided.