lockfuncs.py

I've updated the docstrings. It contained a kind of table which I
converted to a multi-line code block (easier and simpler approach in my
view), and I've made sure that it never exceeds 70 chars in code block
(reformatted it all to fit).
This commit is contained in:
tajmone 2015-03-09 00:54:25 +01:00 committed by Griatch
parent 45ee8104ec
commit b34e8cb740

View file

@ -3,16 +3,16 @@ This module provides a set of permission lock functions for use
with Evennia's permissions system. with Evennia's permissions system.
To call these locks, make sure this module is included in the To call these locks, make sure this module is included in the
settings tuple PERMISSION_FUNC_MODULES then define a lock on the form settings tuple `PERMISSION_FUNC_MODULES` then define a lock on the form
'<access_type>:func(args)' and add it to the object's lockhandler. '<access_type>:func(args)' and add it to the object's lockhandler.
Run the access() method of the handler to execute the lock check. Run the `access()` method of the handler to execute the lock check.
Note that accessing_obj and accessed_obj can be any object type Note that `accessing_obj` and `accessed_obj` can be any object type
with a lock variable/field, so be careful to not expect with a lock variable/field, so be careful to not expect
a certain object type. a certain object type.
Appendix: MUX locks ##Appendix: MUX locks
Below is a list nicked from the MUX help file on the locks available Below is a list nicked from the MUX help file on the locks available
in standard MUX. Most of these are not relevant to core Evennia since in standard MUX. Most of these are not relevant to core Evennia since
@ -22,30 +22,32 @@ available like the MUX ones. So many of these are not available in
basic Evennia, but could all be implemented easily if needed for the basic Evennia, but could all be implemented easily if needed for the
individual game. individual game.
```
MUX Name: Affects: Effect: MUX Name: Affects: Effect:
------------------------------------------------------------------------------- ----------------------------------------------------------------------
DefaultLock: Exits: controls who may traverse the exit to DefaultLock: Exits: controls who may traverse the exit to
its destination. its destination.
Evennia: "traverse:<lockfunc()>" Evennia: "traverse:<lockfunc()>"
Rooms: controls whether the player sees the SUCC Rooms: controls whether the player sees the
or FAIL message for the room following the SUCC or FAIL message for the room
room description when looking at the room. following the room description when
looking at the room.
Evennia: Custom typeclass Evennia: Custom typeclass
Players/Things: controls who may GET the object. Players/Things: controls who may GET the object.
Evennia: "get:<lockfunc()" Evennia: "get:<lockfunc()"
EnterLock: Players/Things: controls who may ENTER the object EnterLock: Players/Things: controls who may ENTER the object
Evennia: Evennia:
GetFromLock: All but Exits: controls who may gets things from a given GetFromLock: All but Exits: controls who may gets things from a
location. given location.
Evennia: Evennia:
GiveLock: Players/Things: controls who may give the object. GiveLock: Players/Things: controls who may give the object.
Evennia: Evennia:
LeaveLock: Players/Things: controls who may LEAVE the object. LeaveLock: Players/Things: controls who may LEAVE the object.
Evennia: Evennia:
LinkLock: All but Exits: controls who may link to the location if the LinkLock: All but Exits: controls who may link to the location
location is LINK_OK (for linking exits or if the location is LINK_OK (for linking
setting drop-tos) or ABODE (for setting exits or setting drop-tos) or ABODE (for
homes) setting homes)
Evennia: Evennia:
MailLock: Players: controls who may @mail the player. MailLock: Players: controls who may @mail the player.
Evennia: Evennia:
@ -53,10 +55,12 @@ DefaultLock: Exits: controls who may traverse the exit to
Evennia: Evennia:
PageLock: Players: controls who may page the player. PageLock: Players: controls who may page the player.
Evennia: "send:<lockfunc()>" Evennia: "send:<lockfunc()>"
ParentLock: All: controls who may make @parent links to the ParentLock: All: controls who may make @parent links to
the object.
Evennia: Typeclasses and
"puppet:<lockstring()>"
ReceiveLock: Players/Things: controls who may give things to the
object. object.
Evennia: Typeclasses and "puppet:<lockstring()>"
ReceiveLock: Players/Things: controls who may give things to the object.
Evennia: Evennia:
SpeechLock: All but Exits: controls who may speak in that location SpeechLock: All but Exits: controls who may speak in that location
Evennia: Evennia:
@ -65,20 +69,23 @@ DefaultLock: Exits: controls who may traverse the exit to
Evennia: Evennia:
TportLock: Rooms/Things: controls who may teleport there TportLock: Rooms/Things: controls who may teleport there
Evennia: Evennia:
UseLock: All but Exits: controls who may USE the object, GIVE the UseLock: All but Exits: controls who may USE the object, GIVE
object money and have the PAY attributes the object money and have the PAY
run, have their messages heard and possibly attributes run, have their messages
acted on by LISTEN and AxHEAR, and invoke heard and possibly acted on by LISTEN
$-commands stored on the object. and AxHEAR, and invoke $-commands
stored on the object.
Evennia: Commands and Cmdsets. Evennia: Commands and Cmdsets.
DropLock: All but rooms: controls who may drop that object. DropLock: All but rooms: controls who may drop that object.
Evennia: Evennia:
VisibleLock: All: Controls object visibility when the object VisibleLock: All: Controls object visibility when the
is not dark and the looker passes the lock. object is not dark and the looker
In DARK locations, the object must also be passes the lock. In DARK locations, the
set LIGHT and the viewer must pass the object must also be set LIGHT and the
VisibleLock. viewer must pass the VisibleLock.
Evennia: Room typeclass with Dark/light script Evennia: Room typeclass with
Dark/light script
```
""" """
from django.conf import settings from django.conf import settings