Starting to clean up and debug the server-side infrastructure
This commit is contained in:
parent
e4d50ff74e
commit
96ace8c75f
9 changed files with 135 additions and 131 deletions
55
evennia/game_template/server/conf/inputhandler_funcs.py
Normal file
55
evennia/game_template/server/conf/inputhandler_funcs.py
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
"""
|
||||
Inputhandler functions
|
||||
|
||||
Inputcommands are always called from the client (they handle server
|
||||
input, hence the name).
|
||||
|
||||
This module is loaded by being included in
|
||||
`settings.INPUT_HANDLER_MODULES`.
|
||||
|
||||
All *global functions* included in this module are
|
||||
considered input-handler functions and can be called
|
||||
by the client to handle input.
|
||||
|
||||
An inputhandler function must have the following call signature:
|
||||
|
||||
cmdname(session, *args, **kwargs)
|
||||
|
||||
Where session will be the active session and *args, **kwargs are extra
|
||||
incoming arguments and keyword properties.
|
||||
|
||||
A special command is the "default" command, which is called when
|
||||
no other cmdname matches:
|
||||
|
||||
default(session, cmdname, *args, **kwargs)
|
||||
|
||||
"""
|
||||
|
||||
# import the contents of the default inputhandler_func module
|
||||
#from evennia.server.inputhandler_funcs import *
|
||||
|
||||
|
||||
# def oob_echo(session, *args, **kwargs):
|
||||
# """
|
||||
# Example echo function. Echoes args, kwargs sent to it.
|
||||
#
|
||||
# Args:
|
||||
# session (Session): The Session to receive the echo.
|
||||
# args (list of str): Echo text.
|
||||
# kwargs (dict of str, optional): Keyed echo text
|
||||
#
|
||||
# """
|
||||
# session.msg(oob=("echo", args, kwargs))
|
||||
#
|
||||
#
|
||||
# def default(session, cmdname, *args, **kwargs):
|
||||
# """
|
||||
# Handles commands without a matching inputhandler func.
|
||||
#
|
||||
# Args:
|
||||
# session (Session): The active Session.
|
||||
# cmdname (str): The (unmatched) command name
|
||||
# args, kwargs (any): Arguments to function.
|
||||
#
|
||||
# """
|
||||
# pass
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
"""
|
||||
OOB configuration.
|
||||
|
||||
This module should be included in (or replace) the
|
||||
default module set in settings.OOB_PLUGIN_MODULES
|
||||
|
||||
A function oob_error will be used as optional error management.
|
||||
The available OOB commands can be extended by changing
|
||||
|
||||
`settings.OOB_PLUGIN_MODULES`
|
||||
|
||||
CMD_MAP: This module must contain a global dictionary CMD_MAP. This is
|
||||
a dictionary that maps the call-name available to a function in this
|
||||
module (this allows you to map multiple oob cmdnames to a single
|
||||
actual Python function, for example).
|
||||
|
||||
oob functions have the following call signature:
|
||||
|
||||
function(session, *args, **kwargs)
|
||||
|
||||
where session is the active session and *args, **kwargs are extra
|
||||
arguments sent with the oob command.
|
||||
|
||||
A function mapped to the key "oob_error" will retrieve error strings
|
||||
if it is defined. It will get the error message as its 1st argument.
|
||||
|
||||
oob_error(session, error, *args, **kwargs)
|
||||
|
||||
This allows for customizing error handling.
|
||||
|
||||
Data is usually returned to the user via a return OOB call:
|
||||
|
||||
session.msg(oob=(oobcmdname, (args,), {kwargs}))
|
||||
|
||||
Oobcmdnames are case-sensitive. Note that args, kwargs must be
|
||||
iterable. Non-iterables will be interpreted as a new command name (you
|
||||
can send multiple oob commands with one msg() call))
|
||||
|
||||
"""
|
||||
|
||||
# import the contents of the default msdp module
|
||||
from evennia.server.oob_cmds import *
|
||||
|
||||
|
||||
# def oob_echo(session, *args, **kwargs):
|
||||
# """
|
||||
# Example echo function. Echoes args, kwargs sent to it.
|
||||
#
|
||||
# Args:
|
||||
# session (Session): The Session to receive the echo.
|
||||
# args (list of str): Echo text.
|
||||
# kwargs (dict of str, optional): Keyed echo text
|
||||
#
|
||||
# """
|
||||
# session.msg(oob=("echo", args, kwargs))
|
||||
#
|
||||
## oob command map
|
||||
# CMD_MAP = {"ECHO": oob_echo}
|
||||
Loading…
Add table
Add a link
Reference in a new issue