feat: implement door interaction

This commit is contained in:
goose
2026-10-01 15:53:07 -04:00
parent e501dbccc6
commit b469c6decb
10 changed files with 249 additions and 14 deletions
+51
View File
@@ -0,0 +1,51 @@
# S5.3 — Task 1: Door interaction report
**Worktree:** `/home/hectelyon/Documents/Projects/ProjetsPersos/DungeonCrawlerWorld/.worktrees/s5-3`
**Branch:** `slice/s5-3-door-interaction`
**Date:** 2026-10-01
## Delivered
- Added the dedicated domain `InteractionResolver` and public `GameState.try_interact()`.
- The resolver uses the frozen target order: player cell, N, E, S, W, NE, SE, SW, NW.
- A closed door becomes `FLOOR`, produces `door_opened`, and triggers the existing enemy-response mechanism exactly once.
- Stairs under the player produce `stairs_used` and set `exit_reached`.
- No target produces exactly `nothing_to_interact`, with no player/enemy state change and no enemy turn.
- Valid interaction refreshes FOV/exploration. Presentation refreshes map visibility, actor views, HUD prompt, and event log through the shared `Game` path.
- `submit_test_interact()` and configured `InputEvent` interaction both converge through `_process_interact()` into `GameState.try_interact()`.
- Extended the project-owned visual check to capture the real application after opening its initial door (`--capture-door`).
- Updated README interaction and capture documentation.
## TDD evidence
1. Added door unit/E2E specifications before domain implementation.
2. **Red:** `./scripts/test-unit.sh` failed as intended because `GameState.try_interact` did not exist (4 new tests failed with `Nonexistent function 'try_interact'`).
3. **Green:** implemented the resolver and shared game path; all unit and E2E checks passed.
## Automated verification
Executed from this worktree using Godot 4.5 and GUT 9.5:
| Command | Result |
|---|---|
| `./scripts/test-unit.sh` | PASS — 25 tests, 108 assertions |
| `./scripts/test-e2e.sh` | PASS — 9 tests, 105 assertions |
| `env -u DISPLAY ./scripts/run-visual-check.sh` | PASS — actual app launched through Xvfb; `artifacts/visual-check.png` is 1280×720 |
| `./scripts/verify.sh` | PASS — unit, E2E, visual checks |
| `git diff --check` | PASS |
The new real-scene E2E test verifies configured Space and E events, the `submit_test_interact()` seam, door opening, confirmation log/prompt refresh, and walking through the former door cell. Unit tests verify order, no-op behavior, FOV recalculation, one enemy response, and stairs precedence.
## Visual proof
- Capture: `artifacts/visual-check.png` (ignored/generated artifact)
- Log: `artifacts/visual-check.log` (ignored/generated artifact)
- Run used Xvfb because `DISPLAY` was explicitly unset.
- Capture was inspected and shows the initial north door rendered as floor, the prompt cleared, and the event log containing `You open the door.`
## Scope and repository hygiene
- Changes are confined to this worktree and task scope.
- No push or PR was created.
- Generated capture files remain ignored and are not part of the commit.