Fix bug that prevented exits with a compass direction alias from displaying

This commit is contained in:
Wendy Wang 2025-02-02 11:10:04 +01:00
parent a2bb02c82c
commit e44f069eb9
2 changed files with 6 additions and 11 deletions

View file

@ -125,16 +125,11 @@ class Map(object):
Returns: Returns:
string: The exit name as a compass direction or an empty string. string: The exit name as a compass direction or an empty string.
""" """
exit_name = ex.name return (
if exit_name not in _COMPASS_DIRECTIONS: ex.name
compass_aliases = [ if ex.name in _COMPASS_DIRECTIONS
direction in ex.aliases.all() for direction in _COMPASS_DIRECTIONS.keys() else next((alias for alias in ex.aliases.all() if alias in _COMPASS_DIRECTIONS), "")
] )
if compass_aliases[0]:
exit_name = compass_aliases[0]
if exit_name not in _COMPASS_DIRECTIONS:
return ""
return exit_name
def update_pos(self, room, exit_name): def update_pos(self, room, exit_name):
""" """

View file

@ -32,7 +32,7 @@ class TestIngameMap(BaseEvenniaCommandTest):
) )
create_object( create_object(
exits.Exit, exits.Exit,
key="west", key="shopfront",
aliases=["w"], aliases=["w"],
location=self.east_room, location=self.east_room,
destination=self.west_room, destination=self.west_room,