Skip to content

Commit 94314b7

Browse files
committed
fix: terrain height check when calculating resource groups
This fix allows all expansions on GoldenauraAIE to be found correctly
1 parent 3ca497e commit 94314b7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

sc2/bot_ai_internal.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,17 @@ def _find_expansion_locations(self):
185185
]
186186
# Loop the merging process as long as we change something
187187
merged_group = True
188+
height_grid: PixelMap = self.game_info.terrain_height
188189
while merged_group:
189190
merged_group = False
190191
# Check every combination of two groups
191192
for group_a, group_b in itertools.combinations(resource_groups, 2):
192193
# Check if any pair of resource of these groups is closer than threshold together
194+
# And that they are on the same terrain level
193195
if any(
194196
resource_a.distance_to(resource_b) <= resource_spread_threshold
197+
and height_grid[resource_a.position.rounded]
198+
== height_grid[resource_b.position.rounded]
195199
for resource_a, resource_b in itertools.product(group_a, group_b)
196200
):
197201
# Remove the single groups and add the merged group

0 commit comments

Comments
 (0)