Make generation more sparse by asking for extra space around rooms; also add out of bounds option to Map.neighbourhood
This commit is contained in:
@ -39,9 +39,16 @@ class Generator:
|
||||
for rx in range(rw):
|
||||
if room[ry][rx] == Tile.FLOOR:
|
||||
ly, lx = y + ry - door_y, x + rx - door_x
|
||||
# tile must be in bounds and empty
|
||||
if not(0 <= ly < lh and 0 <= lx < lw) or \
|
||||
level[ly][lx] == Tile.FLOOR:
|
||||
return False
|
||||
# so do all neighbouring tiles bc we may
|
||||
# need to place walls there eventually
|
||||
for ny, nx in Map.neighbourhood(level, ly, lx, large=True, oob=True):
|
||||
if not(0 <= ny < lh and 0 <= nx < lw) or \
|
||||
level[ny][nx] != Tile.EMPTY:
|
||||
return False
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
|
Reference in New Issue
Block a user