Skip to content

Commit 3e44155

Browse files
committed
Update node.py
1 parent bd8e066 commit 3e44155

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pathfinding3d/core/node.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class GridNode(Node):
101101
# Set it to None if you only have one grid.
102102
grid_id: Optional[int] = None
103103

104-
connections: Optional[List] = None
104+
connections: List["GridNode"] = dataclasses.field(default_factory=list)
105105

106106
def __post_init__(self):
107107
super().__init__()
@@ -126,7 +126,4 @@ def connect(self, other_node: "GridNode"):
126126
other_node : GridNode
127127
The node to connect to.
128128
"""
129-
if not self.connections:
130-
self.connections = [other_node]
131-
else:
132-
self.connections.append(other_node)
129+
self.connections.append(other_node)

0 commit comments

Comments
 (0)