From 3a872723b03193b322d06beacd1e06c134fabc7d Mon Sep 17 00:00:00 2001 From: tolmar Date: Sun, 15 Sep 2019 02:24:48 -0700 Subject: [PATCH] Use connect_one_way when doors are blocked Shuffler doesn't respect blocked doors yet so it may create an unbeatable layout, and the item placer will panic. But that's better than silently giving the player something impossible --- DoorShuffle.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/DoorShuffle.py b/DoorShuffle.py index 430f876a..736a93fa 100644 --- a/DoorShuffle.py +++ b/DoorShuffle.py @@ -124,7 +124,7 @@ def connect_one_way(world, entrancename, exitname, player, skipSpoiler=False): # if these were already connected somewhere, remove the backreference if entrance.connected_region is not None: - entrance.connected_region.entrances.remove(entrance, player) + entrance.connected_region.entrances.remove(entrance) if ext.connected_region is not None: ext.connected_region.entrances.remove(ext) @@ -205,7 +205,12 @@ def maybe_connect_two_way(world, a, b, player): return # Connect supported types if a.type == DoorType.Normal or a.type == DoorType.SpiralStairs: - connect_two_way(world, a.name, b.name, player) + if a.blocked: + connect_one_way(world, b.name, a.name, player) + elif b.blocked: + connect_one_way(world, a.name, b.name, player) + else: + connect_two_way(world, a.name, b.name, player) return # If we failed to account for a type, panic raise RuntimeError('Unknown door type ' + a.type.name)