feat: implement auto-resubscription on room changes and combat transitions #326

Merged
freemo merged 1 commit from feature/m2-ui-resubscribe into master 2026-03-16 20:09:45 +00:00
Owner

Summary

  • Enhances UIEventSubscriber to automatically manage subscriptions when player context changes
  • Implements room change detection with automatic area resubscription when moving to a different area
  • Implements combat start/end lifecycle hooks for automatic CombatInstance subscription management

Changes

  • UIEventSubscriber: Added lifecycle hook registration for room_changed, combat_started, combat_ended events
  • Auto-resubscription handlers: on_room_changed, on_combat_started, on_combat_ended methods
  • Duplicate subscription guards: Prevents subscribing to the same object twice
  • New accessors: current_room, current_area, current_combat, lifecycle_hooks_registered?

Testing

  • 23 unit test scenarios in tests/unit/ui_resubscribe.feature
  • 6 integration test scenarios in tests/integration/ui_resubscribe_integration.feature
  • All existing UIEventSubscriber tests pass (45 scenarios total)

Closes

Closes #300

## Summary - Enhances UIEventSubscriber to automatically manage subscriptions when player context changes - Implements room change detection with automatic area resubscription when moving to a different area - Implements combat start/end lifecycle hooks for automatic CombatInstance subscription management ## Changes - **UIEventSubscriber**: Added lifecycle hook registration for `room_changed`, `combat_started`, `combat_ended` events - **Auto-resubscription handlers**: `on_room_changed`, `on_combat_started`, `on_combat_ended` methods - **Duplicate subscription guards**: Prevents subscribing to the same object twice - **New accessors**: `current_room`, `current_area`, `current_combat`, `lifecycle_hooks_registered?` ## Testing - 23 unit test scenarios in `tests/unit/ui_resubscribe.feature` - 6 integration test scenarios in `tests/integration/ui_resubscribe_integration.feature` - All existing UIEventSubscriber tests pass (45 scenarios total) ## Closes Closes #300
Implements the RenderOp value object class for the UI render pipeline as
specified in issue #304. RenderOps are immutable value objects that describe
rendering instructions without specifying how they should be rendered.

Key features:
- Immutable value objects (frozen after creation) with type, window, and data
- Seven core RenderOp types: text_append, map_refresh, bar_update,
  prompt_update, window_clear, overlay_show, overlay_hide
- Factory methods for convenient construction: RenderOp.text_append(),
  RenderOp.bar_update(), etc.
- Data validation per type (required fields are enforced)
- Equality comparison support (== and hash for use as hash keys)
- to_h serialization for logging and debugging
- Comprehensive YARD documentation

Testing:
- 36 Cucumber scenarios covering all factory methods, immutability,
  validation, equality, and type constants
- 3 integration scenarios for realistic usage patterns

ISSUES CLOSED: #304
freemo force-pushed feature/m2-ui-resubscribe from dc0d1ba128 to f39dfc551d 2026-03-16 16:58:17 +00:00 Compare
freemo force-pushed feature/m2-ui-resubscribe from f39dfc551d to eb109f0aca 2026-03-16 17:33:01 +00:00 Compare
freemo force-pushed feature/m2-ui-resubscribe from eb109f0aca to 80685c4422 2026-03-16 20:09:37 +00:00 Compare
freemo merged commit 80685c4422 into master 2026-03-16 20:09:45 +00:00
freemo deleted branch feature/m2-ui-resubscribe 2026-03-16 20:09:45 +00:00
Sign in to join this conversation.
No reviewers
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.

Dependencies

No dependencies set.

Reference: aethyr/Aethyr#326
No description provided.