diff --git a/agame/action.py b/agame/action.py index 5a4ca99..80b8619 100644 --- a/agame/action.py +++ b/agame/action.py @@ -12,6 +12,7 @@ __all__ = ( "SleepAction", "PrintAction", "TeleportAction", + "PrintRoomAction", "GetAction", "CheckInvItemsAction", "CheckRoomItemsAction", @@ -78,13 +79,31 @@ class TeleportAction(Action): Moves the player to another room. """ + # The room ID to teleport to. room_id: str + # Whether to "announce" the teleportation; i.e., print out the room + # description after teleporting to it. + announce: bool = True + def act(self, game: "Game"): assert ( self.room_id in game.database.rooms ), f"could not find room with id {self.room_id}" game.room = game.database.rooms[self.room_id] + if self.announce: + game.say("", "." * 70, "") + game.print_room() + + +class PrintRoomAction(Action): + """ + Prints the current room. + """ + + def act(self, game: "Game"): + game.say("", "." * 70, "") + game.print_room() @dataclasses.dataclass