Changed at_cmdset_get() hook to at_cmdset_get(**kwargs). This allows for the possibility to control dynamic generation of cmdsets, for example to force Exit cmdsets to be rebuilt. The aliasing command now uses this. Resolves #563.

This commit is contained in:
Griatch 2014-09-20 10:26:59 +02:00
parent ddc86f2a8b
commit 062a545a97
9 changed files with 45 additions and 27 deletions

View file

@ -159,13 +159,20 @@ class CmdSetObjAlias(MuxCommand):
old_aliases = obj.aliases.all()
new_aliases = [alias.strip().lower() for alias in self.rhs.split(',')
if alias.strip()]
# make the aliases only appear once
old_aliases.extend(new_aliases)
aliases = list(set(old_aliases))
# save back to object.
obj.aliases.add(aliases)
# we treat this as a re-caching (relevant for exits to re-build their
# exit commands with the correct aliases)
# we need to trigger this here, since this will force
# (default) Exits to rebuild their Exit commands with the new
# aliases
obj.at_cmdset_get(force_init=True)
# report all aliases on the object
caller.msg("Alias(es) for '%s' set to %s." % (obj.key, str(obj.aliases)))