diff --git a/src/objects/models.py b/src/objects/models.py index af0659cf79..312e348dc8 100644 --- a/src/objects/models.py +++ b/src/objects/models.py @@ -825,8 +825,20 @@ class ObjectDB(TypedObject): _copy by default. Returns: Object (copy of this one) """ - if not new_key: - new_key = "%s_copy" % self.key + def find_clone_key(): + """ + Append 01, 02 etc to obj.key. Checks next higher number in the + same location, then adds the next number available + + returns the new clone name on the form keyXX + """ + key = self.key + num = 1 + for obj in (obj for obj in self.location.contents + if obj.key.startswith(key) and obj.key.lstrip(key).isdigit()): + num += 1 + return "%s%02i" % (key, num) + new_key = new_key or find_clone_key(self) return ObjectDB.objects.copy_object(self, new_key=new_key) delete_iter = 0 diff --git a/src/objects/objects.py b/src/objects/objects.py index e1890f1d06..51539d86e6 100644 --- a/src/objects/objects.py +++ b/src/objects/objects.py @@ -389,15 +389,14 @@ class Object(TypeClass): # controller, for example) dbref = self.dbobj.dbref - - self.locks.add("control:perm(Immortals)") # edit locks/permissions, delete - self.locks.add("examine:perm(Builders)") # examine properties - self.locks.add("view:all()") # look at object (visibility) - self.locks.add("edit:perm(Wizards)") # edit properties/attributes - self.locks.add("delete:perm(Wizards)") # delete object - self.locks.add("get:all()") # pick up object - self.locks.add("call:true()") # allow to call commands on this object - self.locks.add("puppet:id(%s) or perm(Immortals) or pperm(Immortals)" % dbref) # restricts puppeting of this object + self.locks.add(";".join("control:perm(Immortals)", # edit locks/permissions, delete + "examine:perm(Builders)", # examine properties + "view:all()", # look at object (visibility) + "edit:perm(Wizards)", # edit properties/attributes + "delete:perm(Wizards)", # delete object + "get:all()", # pick up object + "call:true()", # allow to call commands on this object + "puppet:id(%s) or perm(Immortals) or pperm(Immortals)" % dbref)) # restricts puppeting of this object def basetype_posthook_setup(self): """ @@ -721,9 +720,8 @@ class Character(Object): overload the defaults (it is called after this one). """ super(Character, self).basetype_setup() - self.locks.add("get:false()") # noone can pick up the character - self.locks.add("call:false()") # no commands can be called on character from outside - + self.locks.add(";".join("get:false()", # noone can pick up the character + "call:false()")) # no commands can be called on character from outside # add the default cmdset from settings import CMDSET_DEFAULT self.cmdset.add_default(CMDSET_DEFAULT, permanent=True) @@ -790,10 +788,10 @@ class Room(Object): """ super(Room, self).basetype_setup() - self.locks.add("get:false();puppet:false()") # would be weird to puppet a room ... + self.locks.add(";".join("get:false()", + "puppet:false()")) # would be weird to puppet a room ... self.location = None - # # Exits # @@ -886,9 +884,9 @@ class Exit(Object): super(Exit, self).basetype_setup() # setting default locks (overload these in at_object_creation() - self.locks.add("puppet:false()") # would be weird to puppet an exit ... - self.locks.add("traverse:all()") # who can pass through exit by default - self.locks.add("get:false()") # noone can pick up the exit + self.locks.add(";".join("puppet:false()", # would be weird to puppet an exit ... + "traverse:all()", # who can pass through exit by default + "get:false()")) # noone can pick up the exit # an exit should have a destination (this is replaced at creation time) if self.dbobj.location: diff --git a/src/utils/utils.py b/src/utils/utils.py index 01723f8207..75cae91f35 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -539,7 +539,7 @@ def from_pickle(data, do_pickle=True): return item elif _IS_PACKED_DBOBJ(item): # this is a tuple and must be done before tuple-check #print item[1], item[2] - if item[2]: #TODO Not sure why this could ever be None, but it can + if item[2]: #Not sure why this could ever be None, but it can return _TO_TYPECLASS(_TO_MODEL_MAP[item[1]].objects.get(id=item[2])) return None elif dtype == tuple: