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 <beauxq@users.noreply.github.com> --------- Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									ce78c75999
								
							
						
					
					
						commit
						62e4285924
					
				| 
						 | 
				
			
			@ -1110,7 +1110,7 @@ class Region:
 | 
			
		|||
        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 @@ class Region:
 | 
			
		|||
        """
 | 
			
		||||
        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})'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue