mirror of
https://github.com/evennia/evennia.git
synced 2026-03-31 21:17:17 +02:00
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"
|
||||
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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue