diff --git a/evennia/commands/default/building.py b/evennia/commands/default/building.py index 743f740265..15c6d98aba 100644 --- a/evennia/commands/default/building.py +++ b/evennia/commands/default/building.py @@ -468,7 +468,10 @@ class CmdCreate(ObjManipCommand): key = "@create" locks = "cmd:perm(create) or perm(Builders)" help_category = "Building" - created_object_permission = "Wizards" # The permission level needed to control or delete the object if not the creator + + # lockstring of newly created objects, for easy overloading. + # Will be formatted with the {id} of the creating object. + new_obj_lockstring = "control:id({id}) or perm(Wizards);delete:id({id}) or perm(Wizards)" def func(self): """ @@ -491,8 +494,7 @@ class CmdCreate(ObjManipCommand): # create object (if not a valid typeclass, the default # object typeclass will automatically be used) - lockstring = "control:id(%s) or perm(%s);delete:id(%s) or perm(%s)" % (caller.id, - self.created_object_permission, caller.id, self.created_object_permission) + lockstring = self.new_obj_lockstring.format(id=caller.id) obj = create.create_object(typeclass, name, caller, home=caller, aliases=aliases, locks=lockstring, report_to=caller) @@ -717,7 +719,12 @@ class CmdDig(ObjManipCommand): key = "@dig" locks = "cmd:perm(dig) or perm(Builders)" help_category = "Building" - created_room_permission = "Wizards" # The permission level needed to control, delete, or edit the room if not the creator + + # lockstring of newly created rooms, for easy overloading. + # Will be formatted with the {id} of the creating object. + new_room_lockstring = "control:id({id}) or perm(Wizards); " \ + "delete:id({id}) or perm(Wizards); " \ + "edit:id({id}) or perm(Wizards)" def func(self): "Do the digging. Inherits variables from ObjManipCommand.parse()" @@ -744,13 +751,10 @@ class CmdDig(ObjManipCommand): typeclass = settings.BASE_ROOM_TYPECLASS # create room - lockstring = "control:id(%s) or perm(%s); delete:id(%s) or perm(%s); edit:id(%s) or perm(%s)" - lockstring = lockstring % (caller.dbref, self.created_room_permission, caller.dbref, - self.created_room_permission, caller.dbref, self.created_room_permission) - new_room = create.create_object(typeclass, room["name"], aliases=room["aliases"], report_to=caller) + lockstring = self.new_room_lockstring.format(id=caller.id) new_room.locks.add(lockstring) alias_string = "" if new_room.aliases.all():