From e8b2729353eac1c1ca5d6aa07a61b2ecb2e1f42a Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 8 May 2022 23:36:56 -0700 Subject: [PATCH] Add blocks_movement to the Entity class --- roguebasin/object.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/roguebasin/object.py b/roguebasin/object.py index a536da0..25fa784 100644 --- a/roguebasin/object.py +++ b/roguebasin/object.py @@ -12,7 +12,7 @@ if TYPE_CHECKING: from .ai import AI class Entity: - '''A single-tile drawable entity with a symbol and position. + '''A single-tile drawable entity with a symbol and position Attributes ---------- @@ -26,18 +26,20 @@ class Entity: A single character string that represents this character on the map ai : Type[AI], optional If an entity can act on its own behalf, an instance of an AI class + blocks_movement : bool + True if this Entity blocks other Entities from moving through its position ''' def __init__(self, symbol: str, *, position: Optional[Point] = None, - ai: Optional[Type['AI']] = None, + blocks_movement: Optional[bool] = True, fg: Optional[Tuple[int, int, int]] = None, bg: Optional[Tuple[int, int, int]] = None): self.position = position if position else Point() self.foreground = fg if fg else (255, 255, 255) self.background = bg self.symbol = symbol - self.ai = ai + self.blocks_movement = blocks_movement def print_to_console(self, console: tcod.Console) -> None: '''Render this Entity to the console''' @@ -47,7 +49,7 @@ class Entity: return f'{self.symbol}[{self.position}]' def __repr__(self) -> str: - return f'{self.__class__.__name__}({self.symbol}, position={self.position}, fg={self.foreground}, bg={self.background})' + return f'{self.__class__.__name__}({self.symbol!r}, position={self.position!r}, fg={self.foreground!r}, bg={self.background!r})' class Actor(Entity): def __init__(self, symbol: str, *,