Expanded the property overload of dig and create by moving the entire lockstring into the property for easier overloading, pertaining to #1135.
This commit is contained in:
parent
26bee8c751
commit
619a9cee57
1 changed files with 12 additions and 8 deletions
|
|
@ -468,7 +468,10 @@ class CmdCreate(ObjManipCommand):
|
||||||
key = "@create"
|
key = "@create"
|
||||||
locks = "cmd:perm(create) or perm(Builders)"
|
locks = "cmd:perm(create) or perm(Builders)"
|
||||||
help_category = "Building"
|
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):
|
def func(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -491,8 +494,7 @@ class CmdCreate(ObjManipCommand):
|
||||||
|
|
||||||
# create object (if not a valid typeclass, the default
|
# create object (if not a valid typeclass, the default
|
||||||
# object typeclass will automatically be used)
|
# object typeclass will automatically be used)
|
||||||
lockstring = "control:id(%s) or perm(%s);delete:id(%s) or perm(%s)" % (caller.id,
|
lockstring = self.new_obj_lockstring.format(id=caller.id)
|
||||||
self.created_object_permission, caller.id, self.created_object_permission)
|
|
||||||
obj = create.create_object(typeclass, name, caller,
|
obj = create.create_object(typeclass, name, caller,
|
||||||
home=caller, aliases=aliases,
|
home=caller, aliases=aliases,
|
||||||
locks=lockstring, report_to=caller)
|
locks=lockstring, report_to=caller)
|
||||||
|
|
@ -717,7 +719,12 @@ class CmdDig(ObjManipCommand):
|
||||||
key = "@dig"
|
key = "@dig"
|
||||||
locks = "cmd:perm(dig) or perm(Builders)"
|
locks = "cmd:perm(dig) or perm(Builders)"
|
||||||
help_category = "Building"
|
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):
|
def func(self):
|
||||||
"Do the digging. Inherits variables from ObjManipCommand.parse()"
|
"Do the digging. Inherits variables from ObjManipCommand.parse()"
|
||||||
|
|
@ -744,13 +751,10 @@ class CmdDig(ObjManipCommand):
|
||||||
typeclass = settings.BASE_ROOM_TYPECLASS
|
typeclass = settings.BASE_ROOM_TYPECLASS
|
||||||
|
|
||||||
# create room
|
# 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"],
|
new_room = create.create_object(typeclass, room["name"],
|
||||||
aliases=room["aliases"],
|
aliases=room["aliases"],
|
||||||
report_to=caller)
|
report_to=caller)
|
||||||
|
lockstring = self.new_room_lockstring.format(id=caller.id)
|
||||||
new_room.locks.add(lockstring)
|
new_room.locks.add(lockstring)
|
||||||
alias_string = ""
|
alias_string = ""
|
||||||
if new_room.aliases.all():
|
if new_room.aliases.all():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue