mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 12:56:30 +01:00
Merge pull request #3863 from jaborsh/patch-2
xyzgrid: Replace nested look with dict lookup & short list filter
This commit is contained in:
commit
5e23764cd5
1 changed files with 7 additions and 9 deletions
|
|
@ -946,16 +946,14 @@ class SmartTeleporterMapLink(MapLink):
|
|||
'pointing to an empty space' error we'd get if returning `None`.
|
||||
|
||||
"""
|
||||
xygrid = self.xymap.xygrid
|
||||
if not self.paired_teleporter:
|
||||
# scan for another teleporter
|
||||
symbol = self.symbol
|
||||
found_teleporters = []
|
||||
for iy, line in xygrid.items():
|
||||
for ix, node_or_link in xygrid[iy].items():
|
||||
if node_or_link.symbol == symbol and node_or_link is not self:
|
||||
found_teleporters.append(node_or_link)
|
||||
|
||||
# find the matching teleporter via pre-built symbol map
|
||||
found_teleporters = [
|
||||
comp
|
||||
for comp in self.xymap.symbol_map.get(self.symbol, [])
|
||||
if comp is not self
|
||||
]
|
||||
|
||||
if not found_teleporters:
|
||||
raise MapParserError("found no matching teleporter to link to.", self)
|
||||
if len(found_teleporters) > 1:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue