mcrfpy.Trigger enum — behavior trigger type identifiers #298

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

Summary

Add a string-evaluating enum for trigger types passed to entity step() callbacks.

Enum values

class Trigger(Enum):
    DONE      # behavior completed its task
    BLOCKED   # next move blocked by collide-label entity
    TARGET    # entity with target label entered FOV

Trigger semantics

Value When fired data argument to step()
DONE Behavior completed (path arrived, sleep finished, custom every turn) Cell arrived at, or None for sleep/custom
BLOCKED Next move blocked by entity with collide label (blocked_cell, blocking_entity) tuple
TARGET Entity with target_label spotted in FOV The spotted entity

Priority

When multiple triggers apply in the same turn: TARGET > BLOCKED > DONE

Implementation

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

// PyTrigger.h
enum class TriggerType : int {
    DONE = 0,
    BLOCKED,
    TARGET
};

Files to create/modify

  • src/PyTrigger.h/cpp — new enum type
  • src/McRFPy_API.cpp — register type
## Summary Add a string-evaluating enum for trigger types passed to entity `step()` callbacks. ## Enum values ```python class Trigger(Enum): DONE # behavior completed its task BLOCKED # next move blocked by collide-label entity TARGET # entity with target label entered FOV ``` ## Trigger semantics | Value | When fired | `data` argument to `step()` | |-------|-----------|----------------------------| | `DONE` | Behavior completed (path arrived, sleep finished, custom every turn) | Cell arrived at, or `None` for sleep/custom | | `BLOCKED` | Next move blocked by entity with collide label | `(blocked_cell, blocking_entity)` tuple | | `TARGET` | Entity with `target_label` spotted in FOV | The spotted entity | ## Priority When multiple triggers apply in the same turn: `TARGET > BLOCKED > DONE` ## Implementation Follow the existing IntEnum pattern (`PyInputState.h/cpp`): ```cpp // PyTrigger.h enum class TriggerType : int { DONE = 0, BLOCKED, TARGET }; ``` ## Files to create/modify - `src/PyTrigger.h/cpp` — new enum type - `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, #297. Required by #299 (step callback).

## 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, #297. Required by #299 (step callback).
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#298
No description provided.