Added at_server_start() and at_server_stop() hooks to allow users to safely initialize their custom systems whenever the server restarts.
This commit is contained in:
parent
7818ca077a
commit
309c03ce43
7 changed files with 81 additions and 33 deletions
30
game/gamesrc/conf/at_server_startstop.py
Normal file
30
game/gamesrc/conf/at_server_startstop.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"""
|
||||
This module contains functions that are imported and called by the
|
||||
server whenever it changes its running status. At the point these
|
||||
functions are run, all applicable hooks on individual objects have
|
||||
already been executed. The main purpose of this is module is to have a
|
||||
safe place to initialize eventual custom modules that your game needs
|
||||
to start up or load.
|
||||
|
||||
The module should define at least these global functions:
|
||||
|
||||
at_server_start()
|
||||
at_server_stop()
|
||||
|
||||
The module used is defined by settings.AT_SERVER_STARTSTOP_MODULE.
|
||||
|
||||
"""
|
||||
|
||||
def at_server_start():
|
||||
"""
|
||||
This is called every time the server starts up (also after a
|
||||
reload or reset).
|
||||
"""
|
||||
pass
|
||||
|
||||
def at_server_stop():
|
||||
"""
|
||||
This is called just before a server is shut down, reloaded or
|
||||
reset.
|
||||
"""
|
||||
pass
|
||||
|
|
@ -1,20 +1,23 @@
|
|||
#
|
||||
# This module holds textual connection screen definitions. All global
|
||||
# string variables (only) in this module are read by Evennia and
|
||||
# assumed to define a Connection screen. You can change which module is
|
||||
# used with settings.CONNECTION_SCREEN_MODULE.
|
||||
#
|
||||
# The names of the string variables doesn't matter (except they
|
||||
# shouldn't start with _), but each should hold a string defining a
|
||||
# connection screen - as seen when first connecting to the game
|
||||
# (before having logged in).
|
||||
#
|
||||
# OBS - If there are more than one string variable viable in this
|
||||
# module, a random one is picked!
|
||||
#
|
||||
# After adding new connection screens to this module you must either
|
||||
# reboot or reload the server to make them available.
|
||||
#
|
||||
"""
|
||||
This module holds textual connection screen definitions. All global
|
||||
string variables (only) in this module are read by Evennia and
|
||||
assumed to define a Connection screen.
|
||||
|
||||
The names of the string variables doesn't matter (except they
|
||||
shouldn't start with _), but each should hold a string defining a
|
||||
connection screen - as seen when first connecting to the game
|
||||
(before having logged in).
|
||||
|
||||
OBS - If there are more than one string variable viable in this
|
||||
module, a random one is picked!
|
||||
|
||||
After adding new connection screens to this module you must either
|
||||
reboot or reload the server to make them available.
|
||||
|
||||
You can change which module is used with
|
||||
settings.CONNECTION_SCREEN_MODULE.
|
||||
|
||||
"""
|
||||
|
||||
from src.utils import utils
|
||||
from src.commands.connection_screen import DEFAULT_SCREEN
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ arguments should be handled (excess ones calling magic (*args,
|
|||
eventual tracebacks by logging the error and returning False.
|
||||
|
||||
See many more examples of lock functions in src.locks.lockfuncs.
|
||||
|
||||
"""
|
||||
|
||||
def myfalse(accessing_obj, accessed_obj, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
#
|
||||
# Example module holding functions for out-of-band protocols to
|
||||
# import and map to given commands from the client. This module
|
||||
# is selected by settings.OOB_FUNC_MODULE.
|
||||
#
|
||||
# All functions defined global in this module will be available
|
||||
# for the oob system to call. They will be called with a session/character
|
||||
# as first argument (depending on if the session is logged in or not),
|
||||
# following by any number of extra arguments. The return value will
|
||||
# be packed and returned to the oob protocol and can be on any form.
|
||||
#
|
||||
"""
|
||||
Example module holding functions for out-of-band protocols to
|
||||
import and map to given commands from the client. This module
|
||||
is selected by settings.OOB_FUNC_MODULE.
|
||||
|
||||
All functions defined global in this module will be available
|
||||
for the oob system to call. They will be called with a session/character
|
||||
as first argument (depending on if the session is logged in or not),
|
||||
following by any number of extra arguments. The return value will
|
||||
be packed and returned to the oob protocol and can be on any form.
|
||||
"""
|
||||
|
||||
def testoob(character, *args, **kwargs):
|
||||
"Simple test function"
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ from src.settings_default import *
|
|||
###################################################
|
||||
|
||||
###################################################
|
||||
# Evennia in-game parsers
|
||||
# Evennia pluggable modules
|
||||
###################################################
|
||||
|
||||
###################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue