Interactable popups - UQcsse3200/2026-studio-4 GitHub Wiki

Interactable popups

Task: #132
PR: #142
Feature: HUD #98

Shows a short prompt when the player is in range of a door, dungeon exit, or pick-up item. The E key still fires interact and itemPickup on KeyboardPlayerInputComponent. The prompt lives on the player so it survives room changes.

Participants

  • Player (KeyboardPlayerInputComponent)
  • RoomManager
  • ItemPickupComponent
  • InteractionPrompt
  • InteractionPromptDisplay

Behaviour

  • Door: Press E — Next room (bookshelf: Press E — Enter dungeon).
  • Blocked exit: same HUD slot (e.g. Defeat all enemies first.).
  • Item: Press E — Pick up <name>. Item wins if both are in range.
  • Leave range or finish pickup: prompt hides.

Flowchart

flowchart TD
    A[Player in range] --> B{Item nearby?}
    B -->|yes| C[Item pickup text]
    B -->|no| D{Exit nearby?}
    D -->|no| E[Hide prompt]
    D -->|yes| F[Exit text from InteractionPrompt]
    C --> G[InteractionPrompt.resolve]
    F --> G
    G --> H[InteractionPromptDisplay.setPrompt]
    H --> I[Player presses E]
    I --> J[interact and itemPickup unchanged]
Loading

Sequence diagram

sequenceDiagram
    participant Room as RoomManager
    participant Pickup as ItemPickupComponent
    participant Copy as InteractionPrompt
    participant HUD as InteractionPromptDisplay
    participant Input as KeyboardPlayerInput

    Room->>Pickup: getPickupPrompt()
    Pickup-->>Room: item text or none
    Room->>Copy: forExit(...)
    Copy-->>Room: exit text or none
    Room->>Copy: resolve(item, exit)
    Copy-->>Room: HUD text
    Room->>HUD: setPrompt(text)
    Note over Input: E key not stolen
    Input->>Input: interact
    Input->>Input: itemPickup
Loading

Tests

  • InteractionPromptTest
  • CharmPickupComponentTest
  • KeyboardPlayerInputComponentTest
⚠️ **GitHub.com Fallback** ⚠️