Room

class Room(val identifier: Identifier, var description: Description, exits: List<Exit> = emptyList(), items: List<Item> = emptyList()) : ExaminableObject, InteractWithItem

A room with a specified identifier and a description.

Constructors

Link copied to clipboard
constructor(identifier: String, description: String, exits: List<Exit> = emptyList(), items: List<Item> = emptyList())

A room with a specified identifier and a description.

constructor(identifier: Identifier, description: Description, exits: List<Exit> = emptyList(), items: List<Item> = emptyList())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val attributes: AttributeManager

An AttributeManager that provides management of all Attribute for this Examinable.

Link copied to clipboard

Get the all characters in this Room.

Link copied to clipboard
open override var commands: List<CustomCommand>

A list of CustomCommand that this Examinable provides.

Link copied to clipboard
open override var description: Description

A Description that describes this object.

Link copied to clipboard

Get the Direction this room was entered from.

Link copied to clipboard

Provides a callback for handling examination of this object.

Link copied to clipboard

Get the all exits.

Link copied to clipboard

Get if this Room has been visited.

Link copied to clipboard
open override var identifier: Identifier

An Identifier that can be used to identify this object.

Link copied to clipboard

Specifies how this Room interacts with various Item.

Link copied to clipboard
open override var isPlayerVisible: Boolean

Returns true if visible to the player, else false.

Link copied to clipboard

Get the all items in this Room.

Link copied to clipboard

Get the all unlocked exits.

Functions

Link copied to clipboard

Add a character to this Room.

Link copied to clipboard
fun addExit(exit: Exit)

Add an exit to this Room.

Link copied to clipboard
fun addItem(item: Item)

Add an item to this Room.

Link copied to clipboard
fun canMove(direction: Direction): Boolean

Determine if a move in this Room is possible in a specified direction. Returns true if the move is possible, else false.

Link copied to clipboard

Get if this Room contains a specified character.

fun containsCharacter(character: String, includeInvisibleCharacters: Boolean = false): Boolean

Get if this Room contains a character. If includeInvisibleCharacters is true then characters that aren't visible to the player are included.

Link copied to clipboard
fun containsInteractionTarget(target: String, includeInvisibleExits: Boolean = false): Boolean

Get if this Room contains an InteractWithItem specified by target. If includeInvisibleExits is true then targets that aren't visible to the player are included.

Link copied to clipboard

Get if this Room contains a specified item.

fun containsItem(item: String, includeInvisibleItems: Boolean = false): Boolean

Get if this Room contains an item. If includeInvisibleItems is true then items that aren't visible to the player are included.

Link copied to clipboard
open override fun examine(scene: ExaminationScene): ExaminationResult

Examine this object to obtain an ExaminationResult. The scene that the examination occurs in must be specified.

Link copied to clipboard
fun findCharacter(character: String, includeInvisibleCharacters: Boolean = false): NonPlayableCharacter?

Find a Character in this Room, specified by character. If includeInvisibleCharacters is true then items that aren't visible to the player are included.

Link copied to clipboard
fun findExit(direction: Direction, includeInvisibleExits: Boolean = false): Exit?

Find the Exit in the specified direction. If includeInvisibleExits is set true then exits which are not player visible will be included. If an exits cannot be found then null is returned.

Link copied to clipboard
fun findInteractionTarget(target: String, includeInvisibleTargets: Boolean = false): InteractWithItem?

Find an InteractWithItem in this Room, specified by target. If includeInvisibleTargets is true then targets that aren't visible to the player are included.

Link copied to clipboard
fun findItem(item: String, includeInvisibleItems: Boolean = false): Item?

Find an Item in this Room, specified by item. If includeInvisibleItems is true then items that aren't visible to the player are included.

Link copied to clipboard
operator fun get(direction: Direction): Exit?

Get the Exit at the specified direction. If no Exit exists in the specified direction then null is returned.

Link copied to clipboard
fun hasExit(direction: Direction, includeInvisibleExits: Boolean = false): Boolean

Get if this Room has an Exit in a specified direction. If includeInvisibleExits is true then exits that aren't visible to the player are included.

Link copied to clipboard
fun hasLockedExitInDirection(direction: Direction, includeInvisibleExits: Boolean = false): Boolean

Get if this Room has a locked Exit in a specified direction. If includeInvisibleExits is true then exits that aren't visible to the player are included.

Link copied to clipboard
fun hasUnlockedExitInDirection(direction: Direction, includeInvisibleExits: Boolean = false): Boolean

Get if this Room has an unlocked Exit in a specified direction. If includeInvisibleExits is true then exits that aren't visible to the player are included.

Link copied to clipboard
open override fun interact(item: Item): InteractionResult

Interact with the specified item.

Link copied to clipboard
fun movedInto(from: Direction?)

Move in to this Room form a specified Direction.

Link copied to clipboard

Remove a character from this Room.

Link copied to clipboard
fun removeExit(exit: Exit)

Remove an exit from this Room.

Link copied to clipboard

Remove a target from this Room. If the target exists in the Room true is returned else false.

Link copied to clipboard
fun removeItem(item: Item)

Remove an item from this Room.

Link copied to clipboard
open override fun toString(): String