Refactor map generator package

- Move room generators to map.generators.room
- Move corridor generators to map.generators.corridor

Generators have a generate() method that generates the things they place,
and an apply() method that applies their objects to a grid of tiles.
This commit is contained in:
Eryn Wells 2023-02-09 16:07:29 -08:00
parent 843aa2823f
commit 9a04692539
7 changed files with 391 additions and 262 deletions

View file

@ -13,6 +13,12 @@ class Point:
x: int = 0
y: int = 0
@property
def neighbors(self) -> Iterator['Point']:
'''Iterator over the neighboring points of `self` in all eight directions.'''
for direction in Direction.all():
yield self + direction
def is_adjacent_to(self, other: 'Point') -> bool:
'''Check if this point is adjacent to, but not overlapping the given point