mcrfpy.Behavior enum — behavior type identifiers #297

Closed
opened 2026-03-15 00:30:21 +00:00 by john · 1 comment
Owner

Summary

Add a string-evaluating enum for behavior types, following the project's pattern for Key, InputState, MouseButton, etc.

Enum values

class Behavior(Enum):
    IDLE       # no-op, entity does not participate in turns
    CUSTOM     # calls step() every turn
    NOISE4     # random cardinal movement
    NOISE8     # random 8-directional movement
    PATH       # A* to destination, one step per turn
    WAYPOINT   # sequential A* to list of points
    PATROL     # ping-pong through point list
    LOOP       # circular through point list
    SLEEP      # pass N turns
    SEEK       # follow DiscreteMap toward source
    FLEE       # follow DiscreteMap away from source

Implementation

Follow the existing IntEnum pattern (e.g., PyInputState.h/cpp):

  • String-evaluating enum values
  • Registered as mcrfpy.Behavior
  • C++ backing enum for use in behavior data struct
// PyBehavior.h
enum class BehaviorType : int {
    IDLE = 0,
    CUSTOM,
    NOISE4,
    NOISE8,
    PATH,
    WAYPOINT,
    PATROL,
    LOOP,
    SLEEP,
    SEEK,
    FLEE
};

Files to create/modify

  • src/PyBehavior.h/cpp — new enum type (follow PyInputState pattern)
  • src/McRFPy_API.cpp — register type
## Summary Add a string-evaluating enum for behavior types, following the project's pattern for `Key`, `InputState`, `MouseButton`, etc. ## Enum values ```python class Behavior(Enum): IDLE # no-op, entity does not participate in turns CUSTOM # calls step() every turn NOISE4 # random cardinal movement NOISE8 # random 8-directional movement PATH # A* to destination, one step per turn WAYPOINT # sequential A* to list of points PATROL # ping-pong through point list LOOP # circular through point list SLEEP # pass N turns SEEK # follow DiscreteMap toward source FLEE # follow DiscreteMap away from source ``` ## Implementation Follow the existing IntEnum pattern (e.g., `PyInputState.h/cpp`): - String-evaluating enum values - Registered as `mcrfpy.Behavior` - C++ backing enum for use in behavior data struct ```cpp // PyBehavior.h enum class BehaviorType : int { IDLE = 0, CUSTOM, NOISE4, NOISE8, PATH, WAYPOINT, PATROL, LOOP, SLEEP, SEEK, FLEE }; ``` ## Files to create/modify - `src/PyBehavior.h/cpp` — new enum type (follow `PyInputState` pattern) - `src/McRFPy_API.cpp` — register type
Author
Owner

Roadmap context

Part of the Grid & Entity Overhaul Roadmap (docs/GRID_ENTITY_OVERHAUL_ROADMAP.md), Phase 2 (Entity Data Model Extensions). Leaf dependency — can be implemented in parallel with #295, #296, #298.

## Roadmap context Part of the Grid & Entity Overhaul Roadmap (`docs/GRID_ENTITY_OVERHAUL_ROADMAP.md`), **Phase 2** (Entity Data Model Extensions). Leaf dependency — can be implemented in parallel with #295, #296, #298.
john closed this issue 2026-03-16 11:21:02 +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.

Reference
john/McRogueFace#297
No description provided.