The Messenger: do all empty state validation during portal shuffle (#4971)

This commit is contained in:
Aaron Wagener
2025-05-10 17:57:16 -05:00
committed by GitHub
parent 53defd3108
commit e809b9328b
4 changed files with 34 additions and 50 deletions

View File

@@ -10,25 +10,8 @@ if TYPE_CHECKING:
from . import MessengerWorld
class MessengerEntrance(Entrance):
world: "MessengerWorld | None" = None
def can_connect_to(self, other: Entrance, dead_end: bool, state: "ERPlacementState") -> bool:
can_connect = super().can_connect_to(other, dead_end, state)
world: MessengerWorld = getattr(self, "world", None)
if not world or world.reachable_locs or not can_connect:
return can_connect
empty_state = CollectionState(world.multiworld, True)
self.connected_region = other.connected_region
empty_state.update_reachable_regions(world.player)
world.reachable_locs = any(loc.can_reach(empty_state) and not loc.is_event for loc in world.get_locations())
self.connected_region = None
return world.reachable_locs and (not state.coupled or self.name != other.name)
class MessengerRegion(Region):
parent: str | None
entrance_type = MessengerEntrance
def __init__(self, name: str, world: "MessengerWorld", parent: str | None = None) -> None:
super().__init__(name, world.player, world.multiworld)