

def func(self):
    'Implement the set attribute - a limited form of @py.'
    caller = self.caller
    if (not self.args):
        caller.msg('Usage: @set obj/attr = value. Use empty value to clear.')
        return
    value = self.rhs
    objname = self.lhs_objattr[0]['name']
    attrs = self.lhs_objattr[0]['attrs']
    if objname.startswith('*'):
        obj = caller.search_player(objname.lstrip('*'))
    else:
        obj = caller.search(objname)
    if (not obj):
        return
    if (not self.check_obj(obj)):
        return
    string = ''
    if ('edit' in self.switches):
        if (len(attrs) > 1):
            caller.msg('The Line editor can only be applied to one attribute at a time.')
            return
        self.edit_handler(obj, attrs[0])
        return
    if (not value):
        if (self.rhs is None):
            if (not attrs):
                attrs = [attr.key for attr in obj.attributes.all()]
            for attr in attrs:
                if (not self.check_attr(obj, attr)):
                    continue
                string += self.view_attr(obj, attr)
            self.caller.msg(string.strip(), raw=True)
            return
        else:
            for attr in attrs:
                if (not self.check_attr(obj, attr)):
                    continue
                string += self.rm_attr(obj, attr)
    else:
        for attr in attrs:
            if (not self.check_attr(obj, attr)):
                continue
            value = _convert_from_string(self, value)
            string += self.set_attr(obj, attr, value)
    caller.msg(string.strip('\n'))

dataset/ETHPy150Open evennia/evennia/evennia/commands/default/building.py CmdSetAttribute.func/original