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:
string: The exit name as a compass direction or an empty string.
"""
exit_name = ex.name
if exit_name not in _COMPASS_DIRECTIONS:
compass_aliases = [
direction in ex.aliases.all() for direction in _COMPASS_DIRECTIONS.keys()
]
if compass_aliases[0]:
exit_name = compass_aliases[0]
if exit_name not in _COMPASS_DIRECTIONS:
return ""
return exit_name
return (
ex.name
if ex.name in _COMPASS_DIRECTIONS
else next((alias for alias in ex.aliases.all() if alias in _COMPASS_DIRECTIONS), "")
)
def update_pos(self, room, exit_name):
"""

View file

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