escapy.game
Core game engine that manages state and dispatches player actions.
- class escapy.game.Game(objects, rooms, inventory, first_room_id)[source]
Bases:
GameProtocolConcrete implementation of
GameProtocol.Holds the mutable game state (rooms, inventory, current room, etc.) and routes player actions to the appropriate object behaviours.
- Parameters:
- quit()[source]
End the game and return a
GameEndedEvent.
- interact(object_id)[source]
Interact with an object in the current room.
If the object is present in the current room and satisfies the
Interactableprotocol, itsinteractcommand is executed.
- interact_inventory(object_id)[source]
Interact with an inventory object, or clear the hand.
If object_id is
None, the hand item is cleared and aPutOffHandEventis emitted.If the object is in the inventory and satisfies
InventoryInteractable, itsinteract_inventorycommand is executed.