evennia.contrib.grid.simpledoor.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 SimpleDoorCmdSet to your CharacterCmdSet:

# in mygame/commands/default_cmdsets.py

from evennia.contrib.grid import simpledoor  <---

class CharacterCmdSet(default_cmds.CharacterCmdSet):
    # ...
    def at_cmdset_creation(self):
        # ...
        self.add(simpledoor.SimpleDoorCmdSet)

Usage:

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.grid.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.grid.simpledoor.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())

at_object_creation()[source]

Called the very first time the door is created.

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.

delete()[source]

Deletes both sides of the door.

at_failed_traverse(traversing_object)[source]

Called when door traverse: lock fails.

Parameters

traversing_object (Typeclassed entity) – The object attempting the traversal.

exception DoesNotExist

Bases: evennia.objects.objects.DefaultExit.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.DefaultExit.MultipleObjectsReturned

path = 'evennia.contrib.grid.simpledoor.simpledoor.SimpleDoor'
typename = 'SimpleDoor'
class evennia.contrib.grid.simpledoor.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)'
search_index_entry = {'aliases': '', 'category': 'building', 'key': '@open', 'no_prefix': 'open ', 'tags': '', 'text': '\n open a new exit from the current room\n\n Usage:\n open <new exit>[;alias;alias..][:typeclass] [,<return exit>[;alias;..][:typeclass]]] = <destination>\n\n Handles the creation of exits. If a destination is given, the exit\n will point there. The <return exit> argument sets up an exit at the\n destination leading back to the current room. Destination name\n can be given both as a #dbref and a name, if that name is globally\n unique.\n\n '}
class evennia.contrib.grid.simpledoor.simpledoor.CmdOpenCloseDoor(**kwargs)[source]

Bases: evennia.commands.default.muxcommand.MuxCommand

Open and close a door

Usage:

open <door> close <door>

key = 'open'
aliases = ['close']
locks = 'cmd:all()'
help_category = 'general'
func()[source]

implement the door functionality

lock_storage = 'cmd:all()'
search_index_entry = {'aliases': 'close', 'category': 'general', 'key': 'open', 'no_prefix': ' close', 'tags': '', 'text': '\n Open and close a door\n\n Usage:\n open <door>\n close <door>\n\n '}
class evennia.contrib.grid.simpledoor.simpledoor.SimpleDoorCmdSet(cmdsetobj=None, key=None)[source]

Bases: evennia.commands.cmdset.CmdSet

at_cmdset_creation()[source]

Hook method - this should be overloaded in the inheriting class, and should take care of populating the cmdset by use of self.add().

path = 'evennia.contrib.grid.simpledoor.simpledoor.SimpleDoorCmdSet'