PlayerInteractUseCase

scalata.application.usecases.playerusecases.PlayerInteractUseCase

Handles the “interact” command (pick up / open / read whatever lies on the tile immediately in front of the player).

==== Flow ====

  • Compute the target coordinate by adding direction.vector to the player’s current position.
  • If an item is present, delegate to its interact(GameSession) method and propagate the result.
  • If the tile is empty, return GameResult.error(GameError.ItemNotPresent).

The method is pure: all updates are returned in a new GameSession; no in-place mutation occurs.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def execute(direction: Direction, gameSession: GameSession): GameResult[GameSession]

Execute an interaction in the specified direction.

Execute an interaction in the specified direction.

Value parameters

direction

cardinal direction chosen by the player

gameSession

current immutable snapshot

Attributes

Returns

a successful GameResult with the updated session, or an error signalling that no item is there

Definition Classes