feat: Add GridPoint.entities and GridPointState.point properties

GridPoint.entities (#114):
- Returns list of entities at this grid cell position
- Enables convenient cell-based entity queries without manual iteration
- Example: grid.at(5, 5).entities → [<Entity>, <Entity>]

GridPointState.point (#16):
- Returns GridPoint if entity has discovered this cell, None otherwise
- Respects entity's perspective: undiscovered cells return None
- Enables entity.at(x,y).point.walkable style access
- Live reference: changes to GridPoint are immediately visible

This provides a simpler solution for #16 without the complexity of
caching stale GridPoint copies. The visible/discovered flags indicate
whether the entity "should" trust the data; Python can implement
memory systems if needed.

closes #114, closes #16

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
John McCardle 2025-12-01 21:04:03 -05:00
commit f33e79a123
5 changed files with 367 additions and 6 deletions

View file

@ -31,6 +31,7 @@ typedef struct {
UIGridPointState* data;
std::shared_ptr<UIGrid> grid;
std::shared_ptr<UIEntity> entity;
int x, y; // Position in grid (needed for .point property)
} PyUIGridPointStateObject;
// UIGridPoint - grid cell data for pathfinding and layer access
@ -49,6 +50,9 @@ public:
static PyObject* get_bool_member(PyUIGridPointObject* self, void* closure);
static PyObject* repr(PyUIGridPointObject* self);
// #114 - entities property: list of entities at this cell
static PyObject* get_entities(PyUIGridPointObject* self, void* closure);
// #150 - Dynamic property access for named layers
static PyObject* getattro(PyUIGridPointObject* self, PyObject* name);
static int setattro(PyUIGridPointObject* self, PyObject* name, PyObject* value);
@ -64,6 +68,9 @@ public:
static int set_bool_member(PyUIGridPointStateObject* self, PyObject* value, void* closure);
static PyGetSetDef getsetters[];
static PyObject* repr(PyUIGridPointStateObject* self);
// #16 - point property: access to GridPoint (None if not discovered)
static PyObject* get_point(PyUIGridPointStateObject* self, void* closure);
};
namespace mcrfpydef {