Add Direction.all() that returns an iterator that produces all the Direction values

This commit is contained in:
Eryn Wells 2022-05-05 08:37:48 -07:00
parent 1247617b87
commit 1cd45d366b
2 changed files with 13 additions and 12 deletions

View file

@ -196,17 +196,7 @@ class RoomsAndCorridorsGenerator(MapGenerator):
if tiles[x, y] != Floor:
continue
neighbors = [
pos + Direction.North,
pos + Direction.NorthEast,
pos + Direction.East,
pos + Direction.SouthEast,
pos + Direction.South,
pos + Direction.SouthWest,
pos + Direction.West,
pos + Direction.NorthWest,
]
neighbors = (pos + direction for direction in Direction.all())
for neighbor in neighbors:
if tiles[neighbor.x, neighbor.y] != Empty:
continue