diff --git a/evennia/commands/command.py b/evennia/commands/command.py index 9676bf7095..ad7aa8746a 100644 --- a/evennia/commands/command.py +++ b/evennia/commands/command.py @@ -103,9 +103,8 @@ def _init_command(cls, **kwargs): # strip the @- etc to allow help to be agnostic stripped_key = cls.key[1:] if cls.key and cls.key[0] in CMD_IGNORE_PREFIXES else "" stripped_aliases = ( - " ".join(al for al in cls.aliases - if al and al[0] in CMD_IGNORE_PREFIXES for al in cls.aliases) - ) + " ".join(al[1:] if al and al[0] in CMD_IGNORE_PREFIXES else al + for al in cls.aliases)) cls.search_index_entry = { "key": cls.key, "aliases": " ".join(cls.aliases), diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index 50d9653cc7..9acd1217b5 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -1945,7 +1945,8 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS): update - *only* re-run at_object_creation on this object meaning locks or other properties set later may remain. reset - clean out *all* the attributes and properties on the - object - basically making this a new clean object. + object - basically making this a new clean object. This will also + reset cmdsets! force - change to the typeclass also if the object already has a typeclass of the same name. list - show available typeclasses. Only typeclasses in modules actually @@ -2155,7 +2156,7 @@ class CmdTypeclass(COMMAND_DEFAULT_CLASS): else: update = "update" in self.switches reset = "reset" in self.switches - hooks = "at_object_creation" if update else "all" + hooks = "at_object_creation" if update and not reset else "all" old_typeclass_path = obj.typeclass_path # special prompt for the user in cases where we want diff --git a/evennia/commands/default/help.py b/evennia/commands/default/help.py index e19d963928..c2fddc3b44 100644 --- a/evennia/commands/default/help.py +++ b/evennia/commands/default/help.py @@ -176,6 +176,7 @@ class CmdHelp(COMMAND_DEFAULT_CLASS): subtopics = '' if suggested: + suggested = sorted(suggested) if click_topics: suggested = [f"|lchelp {sug}|lt|w{sug}|n|le" for sug in suggested] else: @@ -544,11 +545,15 @@ class CmdHelp(COMMAND_DEFAULT_CLASS): return - # search for a specific entry. We need to check for 'read' access here before # building the - # set of possibilities. + # search for a specific entry. We need to check for 'read' access here before + # building the set of possibilities. cmd_help_topics, db_help_topics, file_help_topics = \ self.collect_topics(caller, mode='query') + # get a collection of all keys + aliases to be able to strip prefixes like @ + key_and_aliases = set( + chain(*(cmd._keyaliases for cmd in cmd_help_topics.values()))) + # db-help topics takes priority over file-help file_db_help_topics = {**file_help_topics, **db_help_topics} @@ -585,12 +590,13 @@ class CmdHelp(COMMAND_DEFAULT_CLASS): suggestion_maxnum=self.suggestion_maxnum, fields=search_fields ) - if suggestions: help_text += ( "\n... But matches where found within the help " "texts of the suggestions below.") - # break + suggestions = [self.strip_cmd_prefix(sugg, key_and_aliases) + for sugg in suggestions] + break output = self.format_help_entry( topic=None, # this will give a no-match style title @@ -683,8 +689,6 @@ class CmdHelp(COMMAND_DEFAULT_CLASS): # we reached the bottom of the topic tree help_text = subtopic_map[None] - # get a collection of all keys + aliases to be able to strip prefixes like @ - key_and_aliases = set(chain(*(cmd._keyaliases for cmd in cmd_help_topics.values()))) topic = self.strip_cmd_prefix(topic, key_and_aliases) if subtopics: aliases = None diff --git a/evennia/help/utils.py b/evennia/help/utils.py index 6b15e7a345..52ef5ce5de 100644 --- a/evennia/help/utils.py +++ b/evennia/help/utils.py @@ -57,7 +57,7 @@ def help_search_with_index(query, candidate_entries, suggestion_maxnum=5, fields from lunr import get_default_builder as _LUNR_GET_BUILDER from lunr import stop_word_filter from lunr.stemmer import stemmer - from lunr.trimmer import trimmer + # from lunr.trimmer import trimmer # pre-create a lunr index-builder pipeline where we've removed some of # the stop-words from the default in lunr. diff --git a/evennia/typeclasses/models.py b/evennia/typeclasses/models.py index 63e74555dd..f47f9b267e 100644 --- a/evennia/typeclasses/models.py +++ b/evennia/typeclasses/models.py @@ -572,8 +572,8 @@ class TypedObject(SharedMemoryModel): will be cleared. run_start_hooks (str or None, optional): This is either None, to not run any hooks, "all" to run all hooks defined by - at_first_start, or a string giving the name of the hook - to run (for example 'at_object_creation'). This will + at_first_start, or a string with space-separated hook-names to run + (for example 'at_object_creation'). This will always be called without arguments. no_default (bool, optiona): If set, the swapper will not allow for swapping to a default typeclass in case the @@ -621,7 +621,8 @@ class TypedObject(SharedMemoryModel): self.at_first_save() elif run_start_hooks: # a custom hook-name to call. - getattr(self, run_start_hooks)() + for start_hook in str(run_start_hooks).split(): + getattr(self, run_start_hooks)() # # Lock / permission methods