Linting
This commit is contained in:
parent
2031d7fa67
commit
588357e5bf
|
@ -26,9 +26,11 @@ DEFAULT_PARAMS = {
|
|||
"spawn_per_region": [1, 2],
|
||||
}
|
||||
|
||||
def dist(level, y1, x1, y2, x2):
|
||||
|
||||
def dist(level: List[List[Tile]], y1: int, x1: int, y2: int, x2: int) -> int:
|
||||
"""
|
||||
Compute the minimum walking distance between points (y1, x1) and (y2, x2) on a Tile grid
|
||||
Compute the minimum walking distance between points (y1, x1) and (y2, x2)
|
||||
on a Tile grid
|
||||
"""
|
||||
# simple breadth first search
|
||||
copy = [[t for t in row] for row in level]
|
||||
|
@ -247,8 +249,8 @@ class Generator:
|
|||
if room[y][x] == Tile.EMPTY and \
|
||||
Generator.build_door(room, y, x, dy, dx, length):
|
||||
break
|
||||
else:
|
||||
return None, None
|
||||
else: # pragma: no cover
|
||||
return None, None, None, None
|
||||
|
||||
return y + length * dy, x + length * dx, dy, dx
|
||||
|
||||
|
@ -323,8 +325,8 @@ class Generator:
|
|||
top left corner of the room on the level, then log them as a
|
||||
spawnable region
|
||||
"""
|
||||
if self.queued_area != None:
|
||||
translated_area = [[y+ry, x+rx] for ry, rx in self.queued_area]
|
||||
if self.queued_area is not None:
|
||||
translated_area = [[y + ry, x + rx] for ry, rx in self.queued_area]
|
||||
self.spawn_areas.append(translated_area)
|
||||
self.queued_area = None
|
||||
|
||||
|
@ -333,11 +335,6 @@ class Generator:
|
|||
Populate every spawnable area with some randomly chosen, randomly
|
||||
placed entity
|
||||
"""
|
||||
if self.queued_area is not None:
|
||||
translated_area = [[y + ry, x + rx] for ry, rx in self.queued_area]
|
||||
self.spawn_areas.append(translated_area)
|
||||
self.queued_area = None
|
||||
|
||||
min_c, max_c = self.params["spawn_per_region"]
|
||||
for region in self.spawn_areas:
|
||||
entity_count = randint(min_c, max_c)
|
||||
|
|
Loading…
Reference in New Issue