diff --git a/pathfinding3d/core/node.py b/pathfinding3d/core/node.py index 8b564f1..29b42fc 100644 --- a/pathfinding3d/core/node.py +++ b/pathfinding3d/core/node.py @@ -101,7 +101,7 @@ class GridNode(Node): # Set it to None if you only have one grid. grid_id: Optional[int] = None - connections: Optional[List] = None + connections: List["GridNode"] = dataclasses.field(default_factory=list) def __post_init__(self): super().__init__() @@ -126,7 +126,4 @@ def connect(self, other_node: "GridNode"): other_node : GridNode The node to connect to. """ - if not self.connections: - self.connections = [other_node] - else: - self.connections.append(other_node) + self.connections.append(other_node)