Merge pull request #2099 from volundmush/replaceable_init_setup

Replaceable init setup
This commit is contained in:
Griatch 2020-04-21 00:36:50 +02:00 committed by GitHub
commit 770d2e6b43
3 changed files with 7 additions and 2 deletions

View file

@ -13,7 +13,7 @@
- Added `content_types` indexing to DefaultObject's ContentsHandler. (volund)
- Made most of the networking classes such as Protocols and the SessionHandlers
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
- `is_typeclass(obj (Object), exact (bool))` now defaults to exact=False

View file

@ -22,6 +22,7 @@ import django
django.setup()
import evennia
import importlib
evennia._init()
@ -31,7 +32,6 @@ from django.conf import settings
from evennia.accounts.models import AccountDB
from evennia.scripts.models import ScriptDB
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 import logger
@ -333,6 +333,7 @@ class Evennia(object):
Once finished the last_initial_setup_step is set to -1.
"""
global INFO_DICT
initial_setup = importlib.import_module(settings.INITIAL_SETUP_MODULE)
last_initial_setup_step = ServerConfig.objects.conf("last_initial_setup_step")
if not last_initial_setup_step:
# 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
# started when the autoconnects starts sending menu commands.
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
# 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).