escapy.events

Event types emitted by commands and consumed by the UI layer.

Every player action or game state change is represented as an immutable event dataclass. Commands return lists of events, and the UI layer reacts to them (e.g. showing a message, switching to code-input mode, or ending the game).

class escapy.events.PickedUpEvent(object_id)[source]

Bases: object

An object was removed from the room and added to the inventory.

Parameters:

object_id (str)

object_id: str

Identifier of the picked-up object.

class escapy.events.PutInHandEvent(object_id)[source]

Bases: object

The player selected an inventory object as the active hand item.

Parameters:

object_id (str)

object_id: str

Identifier of the object now held in-hand.

class escapy.events.PutOffHandEvent[source]

Bases: object

The player deselected the active hand item (hand is now empty).

class escapy.events.InteractedWithLockedEvent(object_id)[source]

Bases: object

The player tried to interact with a locked object without the right key.

Parameters:

object_id (str)

object_id: str

Identifier of the locked object.

class escapy.events.UnlockedEvent(object_id)[source]

Bases: object

A locked object was successfully unlocked.

Parameters:

object_id (str)

object_id: str

Identifier of the now-unlocked object.

class escapy.events.RevealedEvent(object_id, room_id, position)[source]

Bases: object

A hidden object was revealed and placed into a room.

Parameters:
object_id: str

Identifier of the revealed object.

room_id: str

Room where the object was placed.

position: Position

Position of the newly placed object.

class escapy.events.MovedToRoomEvent(room_id)[source]

Bases: object

The active room changed.

Parameters:

room_id (str)

room_id: str

Identifier of the new current room.

class escapy.events.AskedForCodeEvent(object_id)[source]

Bases: object

The UI should prompt the player to enter a code.

Parameters:

object_id (str)

object_id: str

Identifier of the object awaiting the code.

class escapy.events.WrongCodeEvent[source]

Bases: object

The player entered an incorrect code.

class escapy.events.InspectedEvent(object_id)[source]

Bases: object

The player inspected an object (e.g. zoomed in on it).

Parameters:

object_id (str)

object_id: str

Identifier of the inspected object.

class escapy.events.GameEndedEvent[source]

Bases: object

The game has ended (player quit or won).

class escapy.events.AddedToInventoryEvent(object_id)[source]

Bases: object

An object was added to the player’s inventory without being picked up from the room.

Parameters:

object_id (str)

object_id: str

Identifier of the added object.

type escapy.events.Event = PickedUpEvent | PutInHandEvent | PutOffHandEvent | InteractedWithLockedEvent | UnlockedEvent | RevealedEvent | MovedToRoomEvent | AskedForCodeEvent | WrongCodeEvent | InspectedEvent | GameEndedEvent | AddedToInventoryEvent

Union of all event types that can be emitted during gameplay.