mirror of
https://github.com/evennia/evennia.git
synced 2026-03-28 18:47:16 +01:00
Fixed bugs and allowed for logging in using one character. Added a simple command for creating a new character.
This commit is contained in:
parent
f1767251c6
commit
b26c3ab872
11 changed files with 204 additions and 111 deletions
|
|
@ -1311,7 +1311,7 @@ class TypedObject(SharedMemoryModel):
|
|||
return False
|
||||
return True
|
||||
|
||||
def set_attribute(self, attribute_name, new_value=None):
|
||||
def set_attribute(self, attribute_name, new_value=None, lockstring=""):
|
||||
"""
|
||||
Sets an attribute on an object. Creates the attribute if need
|
||||
be.
|
||||
|
|
@ -1319,6 +1319,10 @@ class TypedObject(SharedMemoryModel):
|
|||
attribute_name: (str) The attribute's name.
|
||||
new_value: (python obj) The value to set the attribute to. If this is not
|
||||
a str, the object will be stored as a pickle.
|
||||
lockstring - this sets an access restriction on the attribute object. Note that
|
||||
this is normally NOT checked - use the secureattr() access method
|
||||
below to perform access-checked modification of attributes. Lock
|
||||
types checked by secureattr are 'attrread','attredit','attrcreate'.
|
||||
"""
|
||||
attrib_obj = get_attr_cache(self, attribute_name)
|
||||
if not attrib_obj:
|
||||
|
|
@ -1332,6 +1336,8 @@ class TypedObject(SharedMemoryModel):
|
|||
else:
|
||||
# no match; create new attribute
|
||||
attrib_obj = attrclass(db_key=attribute_name, db_obj=self)
|
||||
if lockstring:
|
||||
attrib_obj.locks.add(lockstring)
|
||||
# re-set an old attribute value
|
||||
try:
|
||||
attrib_obj.value = new_value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue