Fix merging mistakes and chunk rooms

This commit is contained in:
Charles Peyrat 2021-01-11 01:18:20 +01:00
parent 5aaef15b2b
commit c854d41579
1 changed files with 3 additions and 8 deletions

View File

@ -278,7 +278,7 @@ class Generator:
if d + (x - j)**2 < r**2:
room[i][j] = Tile.FLOOR
draw_chunk(room, height//2 + 1, width//2 + 1)
draw_chunk(room, h_off + height//2 + 1, w_off + width//2 + 1)
min_w, max_w = w_off + r + 1, width + w_off - r -1
min_h, max_h = h_off + r + 1, height + h_off - r - 1
@ -381,7 +381,7 @@ class Generator:
top left corner of the room on the level, then log them as a
spawnable region
"""
if self.queued_area != None:
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
@ -391,11 +391,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)