Doors and World Interactables

This document explains door types, door interaction logic, and specialized world interactable actors in RPG Engine v6.
Trading, inventory, and generic interaction flow are described in separate system docs.

Door Framework Overview

All doors share a common base and interface:

  • Base class: BP_Interact_Door_Master
    • Inherits from BP_Inter_Buildable (doors can be placed by the building system).
  • Interface: BPI_InteractDoor
  • Saved via: BPI_SaveSystem (Door Save DataS_IA_DoorSave).

BPI_InteractDoor

BPI_InteractDoor defines the common interaction contract for all doors:

  • InteractComponentHasBeenChanged
    Notifies the door that the interaction source changed (another character started/stopped interacting).

  • DoorActionNext
    “Next” action during door interaction (e.g. scroll wheel up for changing code digits or rotating a part).

  • DoorActionPrevious
    “Previous” action (e.g. scroll wheel down).

  • Door ForceCancelLockState
    Called when unlocking/interaction must be aborted instantly (player died, left range, state canceled).

  • InputValueFloat
    Generic float input hook for door/puzzle logic (can be used by custom door types).

BP_InteractComponent routes IA_Interact, mouse wheel, and other inputs to these methods depending on the door type and current state.

Common door parameters (BP_Interact_Door_Master)

BP_Interact_Door_Master exposes core door state parameters:

  • OpenDoor_Rotation (Rotator)
    Rotation for the open state.

  • CloseDoor_Rotation (Rotator)
    Rotation for the closed state.

  • State (E_DoorState)
    Lock state: Locked / Unlocked.

  • Can door by locked again (bool)
    Whether the door can be locked again after being opened/unlocked.

  • Door_OpenClose (E_DoorOpenClose)
    Open/closed state used by animation and save system.

Doors also participate in the global save system:

  • Door Save Data (S_IA_DoorSave) stores:
    • OpenClose (E_DoorOpenClose)
    • DoorState (E_DoorState)
    • DoorCode (int[]) – current code for code doors

On load, all BPI_SaveSystem actors are removed and re-spawned using saved S_SaveContainer data, restoring door rotation, lock state, and codes.

Door Types

Regular Door

Class: BP_Interact_Door

Basic behavior:

  • Aim at the door and press IA_Interact (default F) to toggle open/close.
  • Uses:
    • OpenDoor_Rotation / CloseDoor_Rotation
    • Door_OpenClose for current open/closed state
    • State for lock logic if needed (can be configured as always unlocked).

No mini-games, codes, or key requirements.

Code-Locked Door

Class: BP_Interact_Door_Code

This door is opened by entering the correct numeric code using a 3D “lock wheel”.

Parameters

  • True_Code (Integer[])
    The correct code sequence (e.g. [1, 5, 3, 7]).

  • Max Camera Position (int)
    Code length; must match the length of True_Code. Also used for indexing digit positions.

  • Wheels component with Arrow children (1, 2, 3, 4, …)
    Each Arrow defines the location/axis for a digit wheel. When increasing code length, you must add more Arrow components accordingly.

Behavior

  • When the player looks at the lock and presses IA_Interact:
    • The camera blends to a dedicated door camera (lock view).
    • Interaction mode switches to “code input”.
  • Controls:
    • IA_Interact:
      • Enter code input mode.
      • When pressed again, exits code input mode (confirm/cancel).
    • Mouse wheel:
      • Scroll up → DoorActionNext (increment current digit).
      • Scroll down → DoorActionPrevious (decrement current digit).
    • E (bound in input):
      • Switch to the next digit position (index from 0 to Max Camera Position - 1).
  • When the player moves away or the state CharacterStates.Effects.DoorUnlocking is deactivated:
    • Door ForceCancelLockState is called to reset lock interaction.
  • When the entered code matches True_Code:
    • State becomes Unlocked.
    • Door_OpenClose changes to “Open”.
    • The door rotates to OpenDoor_Rotation and physically opens.
    • The code and state are saved via S_IA_DoorSave.

Players can also change the access code after opening:

  • Close the door.
  • Interact with the lock again to enter “set new code” mode.
  • Input a new sequence and confirm with IA_Interact.

Door with Rotating Latch

Class: BP_Interact_Door_Latch

Door with a simple mechanical latch that must be rotated to unlock.

Parameters

  • Latch_UnlockedRotation (Rotator)
    Rotation of the latch when unlocked.

  • Latch_LockedRotation (Rotator)
    Rotation of the latch when locked.

Behavior

  • Player finds the rotating latch component on the door.
  • Aims at the latch and presses and holds IA_Interact (e.g. F).
  • While held, the latch slowly rotates toward Latch_UnlockedRotation.
  • Once the latch reaches the unlocked state:
    • The door is considered unlocked.
    • The door opens automatically (changes Door_OpenClose and rotation).
  • Re-locking behavior depends on Can door by locked again.

This door type is intentionally “simple but slow” to open.

Door Requiring Wiring Puzzle

Class: BP_Interact_Door_Wiring

Door that opens after solving a 2D wiring mini-game (connect wires of the same color, similar to Among Us).

Parameters

  • Puzzle Widget (UserWidget class)
    UMG widget implementing the wiring mini-game. It must define an OnFinished(bool bSuccess) event.

Behavior

  • On interaction:
    • The door opens Puzzle Widget on the player.
  • The widget:
    • Runs the wiring puzzle.
    • Calls OnFinished(true) when solved and OnFinished(false) on failure/cancel.
  • Inside BP_Interact_Door_Wiring:
    • A handler is bound to the widget’s OnFinished.
    • If bSuccess == true:
      • The door is set to Unlocked.
      • The door opens (Door_OpenClose and rotation).
    • If bSuccess == false:
      • The door remains closed.

You can replace the wiring mini-game by assigning a different widget class in Puzzle Widget, as long as it exposes the same OnFinished(bool) contract.

Key-Locked Door

Class: BP_Interact_Door_Key

Door that requires a specific key item in the player’s inventory.

Parameters

  • Key InfoBP_ItemData
    Item data of the key required to open this door.

Behavior

  • On interaction:
    • The door checks inventory for Key Info via BP_EquipmentComponent.
  • If the key is present:
    • One instance of that key item is removed from the inventory.
    • The door becomes unlocked (State = Unlocked).
    • The door opens (changes Door_OpenClose and rotation).
    • The key is consumed permanently (not returned on closing).
  • If the key is absent:
    • The door remains locked and doesn’t open.

Whether the door can be locked again depends on Can door by locked again.
The key is only required for the first successful unlock.

World Interactables (Non-Door)

This section covers specialized interactable actors that are not NPCs and not pure loot.

Wardrobe Point (Equipment Station)

Actor: BP_EquipmentPoint

Purpose:

  • In-world wardrobe and equipment customization station.

Interaction flow:

  • When the player interacts with BP_EquipmentPoint via BP_InteractComponent:
    • A wardrobe-specific event is sent to the PlayerController.
    • PlayerController opens WBP_Wardrobe_Placeholder_InGame.
  • From the wardrobe UI:
    • Character appearance is updated via BPCharacterSkinComponent.
    • Loadout (weapons, armor, bags) is updated via BP_EquipmentComponent.
  • Changes are saved using the general save/load system (see character/init docs).

Configuration:

  • BP_EquipmentPoint itself does not expose many tunables; main behavior is defined inside the UI and customization systems.

Wash Point (Hygiene Station)

Actor: BP_Inter_WashM (child of BP_Inter_Master)

Purpose:

  • Allows the player to clean the character’s body and reduce contamination.

Interaction flow:

  • On interaction:
    • Calls a function on the character to adjust the Hygiene stat.
    • Plays a wash AnimMontage on the actor’s SkeletalMesh (shower animation).

Configuration notes:

  • No per-actor parameters for “wash speed/strength”; those are configured in the stats/survival system.
  • BP_Inter_WashM is essentially a simple stat trigger plus VFX/animation.

Other Specialized Interactable Actors

Several other interactable actors are defined as BP_Inter_Master or BP_Inter_AutoInit children and plug into the same interaction pipeline:

  • BP_Inter_Buildable
    Base for building-placeable interactables (doors, building pieces).
    Detailed behavior is documented in the building system docs.

  • BP_Inter_WeapModif, BP_Inter_Master_Quest, BP_Int_Buff_Master, etc.
    These are covered in detail in:

    • interaction-and-items.md
    • inventory/equipment documentation
    • buff and quest system docs

From the perspective of this file, they are “non-door world interactables” that:

  • Implement BPI_Interactables / BPI_MulticlassData.
  • May implement BPI_SaveSystem.
  • Are discovered and used by BP_InteractComponent via the same trace and widget flow.

Input and State Integration for Doors

Although doors are world actors, they still integrate with the state system and input routing.

Key points:

  • Input:
    • IA_Interact is the main action used to:
      • Start door interaction (aim + press).
      • Enter/exit code input mode for code doors.
      • Confirm new codes or abort.
    • Mouse wheel:
      • Mapped internally to DoorActionNext / DoorActionPrevious.
    • Extra keys such as E:
      • Used to switch positions (digits, segments) where applicable.
  • State integration:
    • Door unlocking sequences are typically tied to a state, e.g. CharacterStates.Effects.DoorUnlocking.
    • When that state is deactivated for any reason:
      • Door ForceCancelLockState is called on the door.
      • The door resets any transient lock/unlock interaction.

This keeps door logic consistent with the rest of the state-driven interaction architecture.

Save and Persistence Summary

Doors and specialized interactables participate in the same persistence system as other world actors:

  • Implement BPI_SaveSystem.
  • Respond to BPI SS LoadActorFromSaveData using S_SaveContainer.
  • Important for doors:
    • S_IA_DoorSave.OpenClose — open/closed.
    • S_IA_DoorSave.DoorState — locked/unlocked.
    • S_IA_DoorSave.DoorCode — current code (code doors).

On level load:

  • All actors with BPI_SaveSystem are cleared.
  • Save system respawns doors and world interactables based on saved data.
  • Doors restore rotation, lock state, and codes exactly as they were at save time.

Doors and interactables connect to:

  • docs/systems/interaction/interaction-and-items.md
  • docs/systems/interaction/trading-and-vendors.md