Made initial_setup.py replaceable in settings.py

This commit is contained in:
Andrew Bastien 2020-04-13 14:16:22 -07:00
parent 7d78eda3fd
commit 109627090e
3 changed files with 7 additions and 2 deletions

View file

@ -13,7 +13,7 @@
- Added `content_types` indexing to DefaultObject's ContentsHandler. (volund) - Added `content_types` indexing to DefaultObject's ContentsHandler. (volund)
- Made most of the networking classes such as Protocols and the SessionHandlers - Made most of the networking classes such as Protocols and the SessionHandlers
replaceable via `settings.py` for modding enthusiasts. (volund) replaceable via `settings.py` for modding enthusiasts. (volund)
- The `initial_setup.py` file can now be substituted in `settings.py` to customize initial game database state. (volund)
### Already in master ### Already in master
- `is_typeclass(obj (Object), exact (bool))` now defaults to exact=False - `is_typeclass(obj (Object), exact (bool))` now defaults to exact=False

View file

@ -22,6 +22,7 @@ import django
django.setup() django.setup()
import evennia import evennia
import importlib
evennia._init() evennia._init()
@ -31,7 +32,6 @@ from django.conf import settings
from evennia.accounts.models import AccountDB from evennia.accounts.models import AccountDB
from evennia.scripts.models import ScriptDB from evennia.scripts.models import ScriptDB
from evennia.server.models import ServerConfig from evennia.server.models import ServerConfig
from evennia.server import initial_setup
from evennia.utils.utils import get_evennia_version, mod_import, make_iter from evennia.utils.utils import get_evennia_version, mod_import, make_iter
from evennia.utils import logger from evennia.utils import logger
@ -333,6 +333,7 @@ class Evennia(object):
Once finished the last_initial_setup_step is set to -1. Once finished the last_initial_setup_step is set to -1.
""" """
global INFO_DICT global INFO_DICT
initial_setup = importlib.import_module(settings.INITIAL_SETUP_MODULE)
last_initial_setup_step = ServerConfig.objects.conf("last_initial_setup_step") last_initial_setup_step = ServerConfig.objects.conf("last_initial_setup_step")
if not last_initial_setup_step: if not last_initial_setup_step:
# None is only returned if the config does not exist, # None is only returned if the config does not exist,

View file

@ -332,6 +332,10 @@ CONNECTION_SCREEN_MODULE = "server.conf.connection_screens"
# cause issues with menu-logins and autoconnects since the menu will not have # cause issues with menu-logins and autoconnects since the menu will not have
# started when the autoconnects starts sending menu commands. # started when the autoconnects starts sending menu commands.
DELAY_CMD_LOGINSTART = 0.3 DELAY_CMD_LOGINSTART = 0.3
# A module that must exist - this holds the instructions Evennia will use to
# first prepare the database for use. Generally should not be changed. If this
# cannot be imported, bad things will happen.
INITIAL_SETUP_MODULE = "evennia.server.initial_setup"
# An optional module that, if existing, must hold a function # An optional module that, if existing, must hold a function
# named at_initial_setup(). This hook method can be used to customize # 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 server's initial setup sequence (the very first startup of the system).