Implement player lifecycle hooks (on_connect, on_login, on_logout, on_disconnect, on_death, on_respawn, on_room_change) #85

Open
opened 2026-03-15 04:13:04 +00:00 by freemo · 0 comments
Owner

Metadata

  • Commit Message: feat(lifecycle): add player lifecycle hooks
  • Branch: feature/m1-lifecycle-hooks

Background and Context

Player lifecycle hooks enable subsystems to react to player state changes without
coupling to the Player class internals. Event sourcing uses on_login/on_logout
for timestamp tracking, terminal UI uses on_room_change for display updates.

Expected Behavior

  • on_connect fires when a TCP connection is accepted
  • on_login fires after successful authentication
  • on_logout fires when a player issues quit
  • on_disconnect fires on unexpected connection loss
  • on_death fires when player health reaches 0
  • on_respawn fires when player respawns after death
  • on_room_change fires when player moves to a different room

Acceptance Criteria

  • Hook emission points added to PlayerConnection, Player, and MoveCommand
  • Each hook's HookEvent includes the player object and relevant context
  • BDD scenarios verify all seven hooks fire correctly

Subtasks

  • Add on_connect and on_disconnect to PlayerConnection
  • Add on_login and on_logout to login/quit flow
  • Add on_death and on_respawn to health/respawn handlers
  • Add on_room_change to movement action
  • Write Cucumber feature file and step definitions

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the
    Commit Message in Metadata exactly.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata.
  • The commit is submitted as a pull request to master, reviewed, and merged.
## Metadata - **Commit Message**: `feat(lifecycle): add player lifecycle hooks` - **Branch**: `feature/m1-lifecycle-hooks` ## Background and Context Player lifecycle hooks enable subsystems to react to player state changes without coupling to the Player class internals. Event sourcing uses `on_login`/`on_logout` for timestamp tracking, terminal UI uses `on_room_change` for display updates. ## Expected Behavior - `on_connect` fires when a TCP connection is accepted - `on_login` fires after successful authentication - `on_logout` fires when a player issues `quit` - `on_disconnect` fires on unexpected connection loss - `on_death` fires when player health reaches 0 - `on_respawn` fires when player respawns after death - `on_room_change` fires when player moves to a different room ## Acceptance Criteria - Hook emission points added to `PlayerConnection`, `Player`, and `MoveCommand` - Each hook's `HookEvent` includes the player object and relevant context - BDD scenarios verify all seven hooks fire correctly ## Subtasks - [ ] Add `on_connect` and `on_disconnect` to PlayerConnection - [ ] Add `on_login` and `on_logout` to login/quit flow - [ ] Add `on_death` and `on_respawn` to health/respawn handlers - [ ] Add `on_room_change` to movement action - [ ] Write Cucumber feature file and step definitions ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged**.
freemo added this to the v1.3.0 milestone 2026-03-15 04:13:04 +00:00
freemo self-assigned this 2026-03-15 04:25:23 +00:00
freemo modified the milestone from v1.3.0 to v1.0.0 2026-03-16 00:27:58 +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: aethyr/Aethyr#85
No description provided.