From 62e4285924f5825f87ad141562c5a7f8bbb3fc34 Mon Sep 17 00:00:00 2001 From: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com> Date: Fri, 29 Nov 2024 01:41:13 +0100 Subject: [PATCH] Core: Make region.add_exits return the created Entrances (#3885) * Core: Make region.add_exits return the created Entrances * Update BaseClasses.py * Update BaseClasses.py Co-authored-by: Doug Hoskisson --------- Co-authored-by: Doug Hoskisson --- BaseClasses.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 9bf9e68608a5..700a21506ac8 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -1110,7 +1110,7 @@ def create_exit(self, name: str) -> Entrance: return exit_ def add_exits(self, exits: Union[Iterable[str], Dict[str, Optional[str]]], - rules: Dict[str, Callable[[CollectionState], bool]] = None) -> None: + rules: Dict[str, Callable[[CollectionState], bool]] = None) -> List[Entrance]: """ Connects current region to regions in exit dictionary. Passed region names must exist first. @@ -1120,10 +1120,14 @@ def add_exits(self, exits: Union[Iterable[str], Dict[str, Optional[str]]], """ if not isinstance(exits, Dict): exits = dict.fromkeys(exits) - for connecting_region, name in exits.items(): - self.connect(self.multiworld.get_region(connecting_region, self.player), - name, - rules[connecting_region] if rules and connecting_region in rules else None) + return [ + self.connect( + self.multiworld.get_region(connecting_region, self.player), + name, + rules[connecting_region] if rules and connecting_region in rules else None, + ) + for connecting_region, name in exits.items() + ] def __repr__(self): return self.multiworld.get_name_string_for_object(self) if self.multiworld else f'{self.name} (Player {self.player})'