mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 17:56:32 +01:00
Working spawning from both module and store
This commit is contained in:
parent
610399e233
commit
6f5b04e85e
1 changed files with 8 additions and 0 deletions
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue