From 6f5b04e85ebd1d47d68d0a4a6bfb4c80ac09d373 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 10 Mar 2018 14:57:08 +0100 Subject: [PATCH] Working spawning from both module and store --- evennia/utils/spawner.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/evennia/utils/spawner.py b/evennia/utils/spawner.py index 412df31126..3e4bf78112 100644 --- a/evennia/utils/spawner.py +++ b/evennia/utils/spawner.py @@ -422,13 +422,19 @@ def validate_prototype(prototype, protkey=None, protparents=None, _visited=None) protparents = get_protparents() if _visited is None: _visited = [] + protkey = protkey.lower() if protkey is not None else None + assert isinstance(prototype, dict) + if id(prototype) in _visited: raise RuntimeError("%s has infinite nesting of prototypes." % protkey or prototype) + _visited.append(id(prototype)) protstrings = prototype.get("prototype") + if protstrings: for protstring in make_iter(protstrings): + protstring = protstring.lower() if protkey is not None and protstring == protkey: raise RuntimeError("%s tries to prototype itself." % protkey or prototype) protparent = protparents.get(protstring) @@ -546,6 +552,8 @@ def spawn(*prototypes, **kwargs): # get available protparents protparents = get_protparents() + print("protparents: {}".format(protparents)) + # overload module's protparents with specifically given protparents protparents.update(kwargs.get("prototype_parents", {})) for key, prototype in protparents.items():