File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments