Delay import of module-prototypes to avoid init-clash. Resolves #2232.

This commit is contained in:
Griatch 2020-11-12 22:28:14 +01:00
parent e4b1e1c9aa
commit 3bee981cff
2 changed files with 40 additions and 30 deletions

View file

@ -392,8 +392,12 @@ def _init():
BASE_GUEST_TYPECLASS = class_from_module(settings.BASE_GUEST_TYPECLASS) BASE_GUEST_TYPECLASS = class_from_module(settings.BASE_GUEST_TYPECLASS)
del class_from_module del class_from_module
# delayed starts # delayed starts - important so as to not back-access evennia before it has
# finished initializing
GLOBAL_SCRIPTS.start() GLOBAL_SCRIPTS.start()
from .prototypes import prototypes
prototypes.load_module_prototypes()
del prototypes
def set_trace(term_size=(140, 80), debugger="auto"): def set_trace(term_size=(140, 80), debugger="auto"):

View file

@ -144,6 +144,12 @@ def homogenize_prototype(prototype, custom_keys=None):
# module-based prototypes # module-based prototypes
def load_module_prototypes():
"""
This is called by `evennia.__init__` as Evennia initializes. It's important
to do this late so as to not interfere with evennia initialization.
"""
for mod in settings.PROTOTYPE_MODULES: for mod in settings.PROTOTYPE_MODULES:
# to remove a default prototype, override it with an empty dict. # to remove a default prototype, override it with an empty dict.
# internally we store as (key, desc, locks, tags, prototype_dict) # internally we store as (key, desc, locks, tags, prototype_dict)