Fix remaining map contrib issues

This commit is contained in:
Griatch 2021-07-18 23:28:28 +02:00
parent 25781b27d7
commit a3995f5b67
8 changed files with 165 additions and 59 deletions

View file

@ -484,7 +484,7 @@ def search_prototype(key=None, tags=None, require_single=False, return_iterators
if key:
if key in mod_matches:
# exact match
module_prototypes = [mod_matches[key]]
module_prototypes = [mod_matches[key].copy()]
allow_fuzzy = False
else:
# fuzzy matching
@ -494,7 +494,9 @@ def search_prototype(key=None, tags=None, require_single=False, return_iterators
if key in prototype_key
]
else:
module_prototypes = [match for match in mod_matches.values()]
# note - we return a copy of the prototype dict, otherwise using this with e.g.
# prototype_from_object will modify the base prototype for every object
module_prototypes = [match.copy() for match in mod_matches.values()]
# search db-stored prototypes
@ -1053,7 +1055,8 @@ def value_to_obj(value, force=True):
stype = type(value)
if is_iter(value):
if stype == dict:
return {value_to_obj_or_any(key): value_to_obj_or_any(val) for key, val in value.iter()}
return {value_to_obj_or_any(key): value_to_obj_or_any(val)
for key, val in value.items()}
else:
return stype([value_to_obj_or_any(val) for val in value])
return dbid_to_obj(value, ObjectDB)

View file

@ -154,7 +154,8 @@ from evennia.prototypes.prototypes import (
_CREATE_OBJECT_KWARGS = ("key", "location", "home", "destination")
_PROTOTYPE_META_NAMES = ("prototype_key", "prototype_desc", "prototype_tags", "prototype_locks")
_PROTOTYPE_META_NAMES = ("prototype_key", "prototype_desc", "prototype_tags",
"prototype_locks", "prototype_parent")
_PROTOTYPE_ROOT_NAMES = (
"typeclass",
"key",