Better explain EvMenu Union merge behavior. Resolve #3546

This commit is contained in:
Griatch 2024-06-27 14:19:23 +02:00
parent 544639e04e
commit 07cf42ac8f

View file

@ -272,28 +272,17 @@ from fnmatch import fnmatch
from inspect import getfullargspec, isfunction from inspect import getfullargspec, isfunction
from math import ceil from math import ceil
import evennia
from django.conf import settings from django.conf import settings
# i18n # i18n
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
import evennia
from evennia import CmdSet, Command from evennia import CmdSet, Command
from evennia.commands import cmdhandler from evennia.commands import cmdhandler
from evennia.utils import logger from evennia.utils import logger
from evennia.utils.ansi import strip_ansi from evennia.utils.ansi import strip_ansi
from evennia.utils.evtable import EvColumn, EvTable from evennia.utils.evtable import EvColumn, EvTable
from evennia.utils.utils import ( from evennia.utils.utils import (crop, dedent, inherits_from, is_iter, m_len,
crop, make_iter, mod_import, pad, to_str)
dedent,
inherits_from,
is_iter,
m_len,
make_iter,
mod_import,
pad,
to_str,
)
# read from protocol NAWS later? # read from protocol NAWS later?
_MAX_TEXT_WIDTH = settings.CLIENT_DEFAULT_WIDTH _MAX_TEXT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
@ -520,13 +509,15 @@ class EvMenu:
startnode (str, optional): The starting node name in the menufile. startnode (str, optional): The starting node name in the menufile.
cmdset_mergetype (str, optional): 'Replace' (default) means the menu cmdset_mergetype (str, optional): 'Replace' (default) means the menu
commands will be exclusive - no other normal commands will commands will be exclusive - no other normal commands will
be usable while the user is in the menu. 'Union' means the be usable while the user is in the menu. 'Union' does merge the menu
menu commands will be integrated with the existing commands command, but note that the only command used in EvMenu has key/alias
(it will merge with `merge_priority`), if so, make sure that of NOINPUT/NOMATCH. So if you merge with 'Union' and a high `cmdset_prio`
the menu's command names don't collide with existing commands (below), you won't replace individual normal commands as you may
in an unexpected way. Also the CMD_NOMATCH and CMD_NOINPUT will expect. Instead commands will work normally and you'll only always fall
be overloaded by the menu cmdset. Other cmdser mergetypes back to menu commands when no other command is found. There is no way
has little purpose for the menu. to partially replace normal commands with EvMenu actions - to do this,
remove the normal command from the caller's cmdset - if not found
the menu's version will kick in instead.
cmdset_priority (int, optional): The merge priority for the cmdset_priority (int, optional): The merge priority for the
menu command set. The default (1) is usually enough for most menu command set. The default (1) is usually enough for most
types of menus. types of menus.