Prevent keys doors on door pairs that loop on themselves in the same supertile. (Excludes dead ends)

Thus, there's not chance for a keys to be wasted.
This commit is contained in:
aerinon
2021-09-02 17:00:36 -06:00
parent cb8a168b6c
commit 2760841836

View File

@@ -1582,7 +1582,7 @@ def find_key_door_candidates(region, checked, world, player):
if d2.type == DoorType.Normal:
room_b = world.get_room(d2.roomIndex, player)
pos_b, kind_b = room_b.doorList[d2.doorListPos]
valid = kind in okay_normals and kind_b in okay_normals
valid = kind in okay_normals and kind_b in okay_normals and valid_key_door_pair(d, d2)
else:
valid = kind in okay_normals
if valid and 0 <= d2.doorListPos < 4:
@@ -1599,6 +1599,12 @@ def find_key_door_candidates(region, checked, world, player):
return candidates, checked_doors
def valid_key_door_pair(door1, door2):
if door1.roomIndex != door2.roomIndex:
return True
return len(door1.entrance.parent_region.exits) <= 1 or len(door2.entrance.parent_region.exits) <= 1
def reassign_key_doors(builder, world, player):
logger = logging.getLogger('')
logger.debug('Key doors for %s', builder.name)