evennia.contrib.simpledoor¶
SimpleDoor
Contribution - Griatch 2016
A simple two-way exit that represents a door that can be opened and closed. Can easily be expanded from to make it lockable, destroyable etc. Note that the simpledoor is based on Evennia locks, so it will not work for a superuser (which bypasses all locks) - the superuser will always appear to be able to close/open the door over and over without the locks stopping you. To use the door, use @quell or a non-superuser account.
Installation:
Import this module in mygame/commands/default_cmdsets and add the CmdOpen and CmdOpenCloseDoor commands to the CharacterCmdSet; then reload the server.
To try it out, @dig a new room and then use the (overloaded) @open commmand to open a new doorway to it like this:
@open doorway:contrib.simpledoor.SimpleDoor = otherroom
You can then use open doorway’ and **close doorway to change the open state. If you are not superuser (@quell yourself) you’ll find you cannot pass through either side of the door once it’s closed from the other side.
-
class
evennia.contrib.simpledoor.
SimpleDoor
(*args, **kwargs)[source]¶ Bases:
evennia.objects.objects.DefaultExit
A two-way exit “door” with some methods for affecting both “sides” of the door at the same time. For example, set a lock on either of the two sides using exitname.setlock(“traverse:false())
-
setlock
(lockstring)[source]¶ Sets identical locks on both sides of the door.
- Parameters
lockstring (str) – A lockstring, like “traverse:true()”.
-
setdesc
(description)[source]¶ Sets identical descs on both sides of the door.
- Parameters
setdesc (str) – A description.
-
at_failed_traverse
(traversing_object)[source]¶ Called when door traverse: lock fails.
- Parameters
traversing_object (Typeclassed entity) – The object attempting the traversal.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.objects.objects.DefaultExit.MultipleObjectsReturned
-
path
= 'evennia.contrib.simpledoor.SimpleDoor'¶
-
typename
= 'SimpleDoor'¶
-
-
class
evennia.contrib.simpledoor.
CmdOpen
(**kwargs)[source]¶ Bases:
evennia.commands.default.building.CmdOpen
open a new exit from the current room
- Usage:
open <new exit>[;alias;alias..][:typeclass] [,<return exit>[;alias;..][:typeclass]]] = <destination>
Handles the creation of exits. If a destination is given, the exit will point there. The <return exit> argument sets up an exit at the destination leading back to the current room. Destination name can be given both as a #dbref and a name, if that name is globally unique.
-
create_exit
(exit_name, location, destination, exit_aliases=None, typeclass=None)[source]¶ Simple wrapper for the default CmdOpen.create_exit
-
aliases
= []¶
-
help_category
= 'building'¶
-
key
= 'open'¶
-
lock_storage
= 'cmd:perm(open) or perm(Builder)'¶