Minor cleanup for docstring to more succinct
This commit is contained in:
parent
798d5b3059
commit
c4552d6953
3 changed files with 9 additions and 33 deletions
|
|
@ -4,9 +4,8 @@ General Character commands usually available to all characters
|
|||
|
||||
import re
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
import evennia
|
||||
from django.conf import settings
|
||||
from evennia.typeclasses.attributes import NickTemplateInvalid
|
||||
from evennia.utils import utils
|
||||
|
||||
|
|
@ -385,43 +384,16 @@ class NumberedTargetCommand(COMMAND_DEFAULT_CLASS):
|
|||
A class that parses out an optional number component from the input string. This
|
||||
class is intended to be inherited from to provide additional functionality, rather
|
||||
than used on its own.
|
||||
|
||||
Note that the class's __doc__ string (this text) is used by Evennia to create the
|
||||
automatic help entry for the command, so make sure to document consistently here.
|
||||
"""
|
||||
|
||||
def parse(self):
|
||||
"""
|
||||
This method is called by the cmdhandler once the command name
|
||||
has been identified. It creates a new set of member variables
|
||||
that can be later accessed from self.func() (see below)
|
||||
Parser that extracts a `.number` property from the beginning of the input string.
|
||||
|
||||
The following variables are available for our use when entering this
|
||||
method (from the command definition, and assigned on the fly by the
|
||||
cmdhandler):
|
||||
self.key - the name of this command ('look')
|
||||
self.aliases - the aliases of this cmd ('l')
|
||||
self.permissions - permission string for this command
|
||||
self.help_category - overall category of command
|
||||
For example, if the input string is "3 apples", this parser will set `self.number = 3` and
|
||||
`self.args = "apples"`. If the input string is "apples", this parser will set
|
||||
`self.number = 0` and `self.args = "apples"`.
|
||||
|
||||
self.caller - the object calling this command
|
||||
self.cmdstring - the actual command name used to call this
|
||||
(this allows you to know which alias was used,
|
||||
for example)
|
||||
self.args - the raw input; everything following self.cmdstring.
|
||||
self.cmdset - the cmdset from which this command was picked. Not
|
||||
often used (useful for commands like 'help' or to
|
||||
list all available commands etc)
|
||||
self.obj - the object on which this command was defined. It is often
|
||||
the same as self.caller.
|
||||
|
||||
This parser does additional parsing on self.args to identify a leading number,
|
||||
storing the results in the following variables:
|
||||
self.number = an integer representing the amount, or 0 if none was given
|
||||
self.args = the re-defined input with the leading number removed
|
||||
|
||||
Optionally, if COMMAND_DEFAULT_CLASS is a MuxCommand, it applies the same
|
||||
parsing to self.lhs
|
||||
"""
|
||||
super().parse()
|
||||
self.number = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue