mirror of
https://github.com/evennia/evennia.git
synced 2026-03-30 12:37:16 +02:00
Fixed a bug in @set that would not display attributes if they were set to 0 or None.
This commit is contained in:
parent
7600892d5d
commit
a429047452
1 changed files with 8 additions and 8 deletions
|
|
@ -1079,24 +1079,24 @@ class CmdSetAttribute(ObjManipCommand):
|
|||
if self.rhs == None:
|
||||
# no = means we inspect the attribute(s)
|
||||
for attr in attrs:
|
||||
value = obj.attr(attr)
|
||||
if value:
|
||||
string += "\n%s.db.%s = %s" % (obj.name, attr, value)
|
||||
if obj.has_attribute(attr):
|
||||
string += "\nAttribute %s/%s = %s" % (obj.name, attr, obj.get_attribute(attr))
|
||||
else:
|
||||
string += "\n%s has no attribute '%s'." % (obj.name, attr)
|
||||
else:
|
||||
# deleting the attribute(s)
|
||||
for attr in attrs:
|
||||
if obj.attr(attr):
|
||||
obj.attr(attr, delete=True)
|
||||
string += "\nAttribute %s.db.%s deleted." % (obj.name, attr)
|
||||
if obj.has_attribute(attr):
|
||||
val = obj.get_attribute(attr)
|
||||
obj.del_attribute(attr)
|
||||
string += "\nDeleted attribute '%s' (= %s) from %s." % (attr, val, obj.name)
|
||||
else:
|
||||
string += "\n%s has no attribute '%s'." % (obj.name, attr)
|
||||
else:
|
||||
# setting attribute(s)
|
||||
for attr in attrs:
|
||||
obj.attr(attr, value)
|
||||
string += "\nAttribute %s.%s created." % (obj.name, attr)
|
||||
obj.set_attribute(attr, value)
|
||||
string += "\nCreated attribute %s/%s = %s" % (obj.name, attr, value)
|
||||
# send feedback
|
||||
caller.msg(string.strip('\n'))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue