mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Added at_initial_setup hook. Create a module in game/ and point to it with settings.AT_INITIAL_SETUP_HOOK_MODULE. This module must contain at function at_initial_setup(), which will be called very last in the setup procedure. If no module is given or fail to load, this will fail quietly.
This commit is contained in:
parent
7f31534618
commit
8d3817ccd4
2 changed files with 22 additions and 2 deletions
|
|
@ -178,6 +178,20 @@ def create_admin_media_links():
|
|||
print _(" Admin-media symlinked to ADMIN_MEDIA_ROOT.")
|
||||
else:
|
||||
print _(" Admin-media files should be copied manually to ADMIN_MEDIA_ROOT.")
|
||||
|
||||
def at_initial_setup():
|
||||
"""
|
||||
Custom hook for users to overload some or all parts of the initial setup. Called very
|
||||
last in the sequence. It tries to import and run a module
|
||||
"""
|
||||
try:
|
||||
mod = __import__(settings.AT_INITIAL_SETUP_HOOK_MODULE, fromlist=[None])
|
||||
except ImportError:
|
||||
return
|
||||
print _(" Running at_initial_setup() hook.")
|
||||
if mod.__dict__.get("at_initial_setup", None):
|
||||
mod.at_initial_setup()
|
||||
|
||||
|
||||
def handle_setup(last_step):
|
||||
"""
|
||||
|
|
@ -202,12 +216,13 @@ def handle_setup(last_step):
|
|||
create_system_scripts,
|
||||
start_game_time,
|
||||
create_admin_media_links,
|
||||
import_MUX_help_files]
|
||||
import_MUX_help_files,
|
||||
at_initial_setup]
|
||||
|
||||
if not settings.IMPORT_MUX_HELP:
|
||||
# skip importing of the MUX helpfiles, they are
|
||||
# not interesting except for developers.
|
||||
del setup_queue[-1]
|
||||
del setup_queue[-2]
|
||||
|
||||
#print " Initial setup: %s steps." % (len(setup_queue))
|
||||
|
||||
|
|
|
|||
|
|
@ -159,6 +159,11 @@ SEARCH_AT_MULTIMATCH_INPUT = "src.commands.cmdparser.at_multimatch_input"
|
|||
# This module should contain one or more variables
|
||||
# with strings defining the look of the screen.
|
||||
CONNECTION_SCREEN_MODULE = "game.gamesrc.world.connection_screens"
|
||||
# An option al module that, if existing, must hold a function
|
||||
# named at_initial_setup(). This hook method can be used to customize
|
||||
# the server's initial setup sequence (the very first startup of the system).
|
||||
# The check will fail quietly if module doesn't exist or fails to load.
|
||||
AT_INITIAL_SETUP_HOOK_MODULE = "game.gamesrc.world.at_initial_setup"
|
||||
|
||||
###################################################
|
||||
# Default command sets
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue