mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Fix bug in multi-object alias targeting. Resolves #1823
This commit is contained in:
parent
e130ec2d6f
commit
08b0f3fbf8
3 changed files with 7 additions and 5 deletions
|
|
@ -170,7 +170,7 @@ def _init():
|
|||
global create_message, create_help_entry
|
||||
global settings, lockfuncs, logger, utils, gametime, ansi, spawn, managers
|
||||
global contrib, TICKER_HANDLER, MONITOR_HANDLER, SESSION_HANDLER
|
||||
global CHANNEL_HANDLER, TASK_HANDLER
|
||||
global CHANNEL_HANDLER, TASK_HANDLER
|
||||
global GLOBAL_SCRIPTS, OPTION_CLASSES
|
||||
global EvMenu, EvTable, EvForm, EvMore, EvEditor
|
||||
global ANSIString
|
||||
|
|
|
|||
|
|
@ -281,11 +281,11 @@ class ObjectDBManager(TypedObjectManager):
|
|||
index_matches = string_partial_matching(key_strings, ostring, ret_index=True)
|
||||
if index_matches:
|
||||
# a match by key
|
||||
return [obj for ind, obj in enumerate(search_candidates) if ind in index_matches]
|
||||
return list({obj for ind, obj in enumerate(search_candidates) if ind in index_matches})
|
||||
else:
|
||||
# match by alias rather than by key
|
||||
search_candidates = search_candidates.filter(db_tags__db_tagtype__iexact="alias",
|
||||
db_tags__db_key__icontains=ostring)
|
||||
db_tags__db_key__icontains=ostring).distinct()
|
||||
alias_strings = []
|
||||
alias_candidates = []
|
||||
# TODO create the alias_strings and alias_candidates lists more efficiently?
|
||||
|
|
@ -295,7 +295,8 @@ class ObjectDBManager(TypedObjectManager):
|
|||
alias_candidates.append(candidate)
|
||||
index_matches = string_partial_matching(alias_strings, ostring, ret_index=True)
|
||||
if index_matches:
|
||||
return [alias_candidates[ind] for ind in index_matches]
|
||||
# it's possible to have multiple matches to the same Object, we must weed those out
|
||||
return list({alias_candidates[ind] for ind in index_matches})
|
||||
return []
|
||||
|
||||
# main search methods and helper functions
|
||||
|
|
@ -507,7 +508,7 @@ class ObjectDBManager(TypedObjectManager):
|
|||
# copy over all tags, if any
|
||||
for tag in original_object.tags.get(return_tagobj=True, return_list=True):
|
||||
new_object.tags.add(tag=tag.key, category=tag.category, data=tag.data)
|
||||
|
||||
|
||||
return new_object
|
||||
|
||||
def clear_all_sessids(self):
|
||||
|
|
|
|||
|
|
@ -466,6 +466,7 @@ class DefaultObject(with_metaclass(TypeclassBase, ObjectDB)):
|
|||
candidates=candidates,
|
||||
exact=exact,
|
||||
use_dbref=use_dbref)
|
||||
|
||||
if quiet:
|
||||
return results
|
||||
return _AT_SEARCH_RESULT(results, self, query=searchdata,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue