mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Merge branch 'cmdset_fallback' of git://github.com/TehomCD/evennia into TehomCD-cmdset_fallback
This commit is contained in:
commit
2fa04162c3
2 changed files with 17 additions and 0 deletions
|
|
@ -351,6 +351,17 @@ class CmdSetHandler(object):
|
|||
elif path:
|
||||
cmdset = self._import_cmdset(path)
|
||||
if cmdset:
|
||||
if cmdset.key == '_CMDSET_ERROR':
|
||||
# If a cmdset fails to load, check if we have a fallback path to use
|
||||
fallback_path = settings.CMDSET_FALLBACKS.get(path, None)
|
||||
if fallback_path:
|
||||
logger.log_err("Error encountered for cmdset at path %s. Replacing with: %s" % (
|
||||
path, fallback_path))
|
||||
cmdset = self._import_cmdset(fallback_path)
|
||||
# If no cmdset is returned from the fallback, we can't go further
|
||||
if not cmdset:
|
||||
logger.log_err("Fallback path '%s' failed to generate a cmdset." % fallback_path)
|
||||
continue
|
||||
cmdset.permanent = cmdset.key != '_CMDSET_ERROR'
|
||||
self.cmdset_stack.append(cmdset)
|
||||
|
||||
|
|
|
|||
|
|
@ -348,6 +348,12 @@ CMDSET_CHARACTER = "commands.default_cmdsets.CharacterCmdSet"
|
|||
CMDSET_PLAYER = "commands.default_cmdsets.PlayerCmdSet"
|
||||
# Location to search for cmdsets if full path not given
|
||||
CMDSET_PATHS = ["commands", "evennia", "contribs"]
|
||||
# Fallbacks for cmdset paths that fail to load. Note that if you change the path for your default cmdsets,
|
||||
# you will also need to copy CMDSET_FALLBACKS after your change in your settings file for it to detect the change.
|
||||
CMDSET_FALLBACKS = {CMDSET_CHARACTER: 'evennia.commands.default.cmdset_character.CharacterCmdSet',
|
||||
CMDSET_PLAYER: 'evennia.commands.default.cmdset_player.PlayerCmdSet',
|
||||
CMDSET_SESSION: 'evennia.commands.default.cmdset_session.SessionCmdSet',
|
||||
CMDSET_UNLOGGEDIN: 'evennia.commands.default.cmdset_unloggedin.UnloggedinCmdSet'}
|
||||
# Parent class for all default commands. Changing this class will
|
||||
# modify all default commands, so do so carefully.
|
||||
COMMAND_DEFAULT_CLASS = "evennia.commands.default.muxcommand.MuxCommand"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue