mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
fix attribute view in CmdSetAttribute
This commit is contained in:
parent
d36c5d8fd5
commit
3ebc9316f9
1 changed files with 15 additions and 6 deletions
|
|
@ -1854,12 +1854,21 @@ class CmdSetAttribute(ObjManipCommand):
|
|||
nested = False
|
||||
for key, nested_keys in self.split_nested_attr(attr):
|
||||
nested = True
|
||||
if obj.attributes.has(key):
|
||||
val = obj.attributes.get(key)
|
||||
val = self.do_nested_lookup(val, *nested_keys)
|
||||
if val is not self.not_found:
|
||||
return f"\nAttribute {obj.name}/|w{attr}|n [category:{category}] = {val}"
|
||||
error = f"\nAttribute {obj.name}/|w{attr} [category:{category}] does not exist."
|
||||
if obj.attributes.has(key, category):
|
||||
if nested_keys:
|
||||
val = obj.attributes.get(key, category=category)
|
||||
deep = self.do_nested_lookup(val, *nested_keys[:-1])
|
||||
if deep is not self.not_found:
|
||||
try:
|
||||
val = deep[nested_keys[-1]]
|
||||
except (IndexError, KeyError, TypeError):
|
||||
continue
|
||||
return f"\nAttribute {obj.name}/|w{attr}|n [category:{category}] = {val}"
|
||||
else:
|
||||
val = obj.attributes.get(key, category=category)
|
||||
if val:
|
||||
return f"\nAttribute {obj.name}/|w{attr}|n [category:{category}] = {val}"
|
||||
error = f"\nAttribute {obj.name}/|w{attr}|n [category:{category}] does not exist."
|
||||
if nested:
|
||||
error += " (Nested lookups attempted)"
|
||||
return error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue