evennia.objects package

This sub-package defines the basic in-game “Object”. All in-game objects inherit from classes in this package.

Subpackages

Submodules

evennia.objects.admin module

class evennia.objects.admin.ObjectAttributeInline(parent_model, admin_site)[source]

Bases: evennia.typeclasses.admin.AttributeInline

Defines inline descriptions of Attributes (experimental)

property media
model

alias of evennia.objects.models.ObjectDB_db_attributes

related_field = 'objectdb'
class evennia.objects.admin.ObjectCreateForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.models.ModelForm

This form details the look of the fields.

class Meta[source]

Bases: object

fields = '__all__'
model

alias of evennia.objects.models.ObjectDB

_meta = <django.forms.models.ModelFormOptions object>
base_fields = {'db_account': <django.forms.models.ModelChoiceField object>, 'db_attributes': <django.forms.models.ModelMultipleChoiceField object>, 'db_cmdset_storage': <django.forms.fields.CharField object>, 'db_destination': <django.forms.models.ModelChoiceField object>, 'db_home': <django.forms.models.ModelChoiceField object>, 'db_key': <django.forms.fields.CharField object>, 'db_location': <django.forms.models.ModelChoiceField object>, 'db_lock_storage': <django.forms.fields.CharField object>, 'db_sessid': <django.forms.fields.CharField object>, 'db_tags': <django.forms.models.ModelMultipleChoiceField object>, 'db_typeclass_path': <django.forms.fields.CharField object>}
declared_fields = {'db_cmdset_storage': <django.forms.fields.CharField object>, 'db_key': <django.forms.fields.CharField object>, 'db_typeclass_path': <django.forms.fields.CharField object>}
property media
raw_id_fields = ('db_destination', 'db_location', 'db_home')
class evennia.objects.admin.ObjectDBAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Describes the admin page for Objects.

add_fieldsets = ((None, {'fields': (('db_key', 'db_typeclass_path'), ('db_location', 'db_home'), 'db_destination', 'db_cmdset_storage')}),)
add_form

alias of ObjectCreateForm

fieldsets = ((None, {'fields': (('db_key', 'db_typeclass_path'), ('db_lock_storage',), ('db_location', 'db_home'), 'db_destination', 'db_cmdset_storage')}),)
form

alias of ObjectEditForm

get_fieldsets(request, obj=None)[source]

Return fieldsets.

Parameters
  • request (Request) – Incoming request.

  • obj (ObjectDB, optional) – Database object.

get_form(request, obj=None, **kwargs)[source]

Use special form during creation.

Parameters
  • request (Request) – Incoming request.

  • obj (Object, optional) – Database object.

inlines = [<class 'evennia.objects.admin.ObjectTagInline'>, <class 'evennia.objects.admin.ObjectAttributeInline'>]
list_display = ('id', 'db_key', 'db_account', 'db_typeclass_path')
list_filter = ('db_typeclass_path',)
property media
ordering = ['db_account', 'db_typeclass_path', 'id']
raw_id_fields = ('db_destination', 'db_location', 'db_home')
response_add(request, obj, post_url_continue=None)[source]

Determine the HttpResponse for the add_view stage.

save_as = True
save_model(request, obj, form, change)[source]

Model-save hook.

Parameters
  • request (Request) – Incoming request.

  • obj (Object) – Database object.

  • form (Form) – Form instance.

  • change (bool) – If this is a change or a new object.

save_on_top = True
search_fields = ['=id', '^db_key', 'db_typeclass_path', '^db_account__db_key']
class evennia.objects.admin.ObjectEditForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: evennia.objects.admin.ObjectCreateForm

Form used for editing. Extends the create one with more fields

class Meta[source]

Bases: object

fields = '__all__'
_meta = <django.forms.models.ModelFormOptions object>
base_fields = {'db_cmdset_storage': <django.forms.fields.CharField object>, 'db_key': <django.forms.fields.CharField object>, 'db_lock_storage': <django.forms.fields.CharField object>, 'db_typeclass_path': <django.forms.fields.CharField object>}
declared_fields = {'db_cmdset_storage': <django.forms.fields.CharField object>, 'db_key': <django.forms.fields.CharField object>, 'db_lock_storage': <django.forms.fields.CharField object>, 'db_typeclass_path': <django.forms.fields.CharField object>}
property media
class evennia.objects.admin.ObjectTagInline(parent_model, admin_site)[source]

Bases: evennia.typeclasses.admin.TagInline

Defines inline descriptions of Tags (experimental)

property media
model

alias of evennia.objects.models.ObjectDB_db_tags

related_field = 'objectdb'

evennia.objects.manager module

Custom manager for Objects.

class evennia.objects.manager.ObjectManager[source]

Bases: evennia.objects.manager.ObjectDBManager, evennia.typeclasses.managers.TypeclassManager

evennia.objects.models module

This module defines the database models for all in-game objects, that is, all objects that has an actual existence in-game.

Each database object is ‘decorated’ with a ‘typeclass’, a normal python class that implements all the various logics needed by the game in question. Objects created of this class transparently communicate with its related database object for storing all attributes. The admin should usually not have to deal directly with this database object layer.

Attributes are separate objects that store values persistently onto the database object. Like everything else, they can be accessed transparently through the decorating TypeClass.

class evennia.objects.models.ContentsHandler(obj)[source]

Bases: object

Handles and caches the contents of an object to avoid excessive lookups (this is done very often due to cmdhandler needing to look for object-cmdsets). It is stored on the ‘contents_cache’ property of the ObjectDB.

__init__(obj)[source]

Sets up the contents handler.

Parameters

obj (Object) – The object on which the handler is defined

add(obj)[source]

Add a new object to this location

Parameters

obj (Object) – object to add

clear()[source]

Clear the contents cache and re-initialize

get(exclude=None, content_type=None)[source]

Return the contents of the cache.

Parameters
  • exclude (Object or list of Object) – object(s) to ignore

  • content_type (str or None) – Filter list by a content-type. If None, don’t filter.

Returns

the Objects inside this location

Return type

objects (list)

init()[source]

Re-initialize the content cache

load()[source]

Retrieves all objects from database. Used for initializing.

Returns

Objects (list of ObjectDB)

remove(obj)[source]

Remove object from this location

Parameters

obj (Object) – object to remove

class evennia.objects.models.ObjectDB(*args, **kwargs)[source]

Bases: evennia.typeclasses.models.TypedObject

All objects in the game use the ObjectDB model to store data in the database. This is handled transparently through the typeclass system.

Note that the base objectdb is very simple, with few defined fields. Use attributes to extend your type class with new database-stored variables.

The TypedObject supplies the following (inherited) properties:

  • key - main name

  • name - alias for key

  • db_typeclass_path - the path to the decorating typeclass

  • db_date_created - time stamp of object creation

  • permissions - perm strings

  • locks - lock definitions (handler)

  • dbref - #id of object

  • db - persistent attribute storage

  • ndb - non-persistent attribute storage

The ObjectDB adds the following properties:

  • account - optional connected account (always together with sessid)

  • sessid - optional connection session id (always together with account)

  • location - in-game location of object

  • home - safety location for object (handler)

  • scripts - scripts assigned to object (handler from typeclass)

  • cmdset - active cmdset on object (handler from typeclass)

  • aliases - aliases for this object (property)

  • nicks - nicknames for other things in Evennia (handler)

  • sessions - sessions connected to this object (see also account)

  • has_account - bool if an active account is currently connected

  • contents - other objects having this object as location

  • exits - exits from this object

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

_ObjectDB__cmdset_storage_del()

deleter

_ObjectDB__cmdset_storage_get()

getter

_ObjectDB__cmdset_storage_set(value)

setter

_ObjectDB__location_del()

Cleanly delete the location reference

_ObjectDB__location_get()

Get location

_ObjectDB__location_set(location)

Set location, checking for loops and allowing dbref

_is_deleted = False
_meta = <Options for ObjectDB>
property account

A wrapper for getting database field db_account.

at_db_location_postsave(new)[source]

This is called automatically after the location field was saved, no matter how. It checks for a variable _safe_contents_update to know if the save was triggered via the location handler (which updates the contents cache) or not.

Parameters

new (bool) – Set if this location has not yet been saved before.

property cmdset_storage

getter

contents_cache[source]
db_account

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

db_account_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

db_attributes

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

db_cmdset_storage

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

db_destination

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

db_destination_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

db_home

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

db_home_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

db_location

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

db_location_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

db_sessid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

db_tags

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property destination

A wrapper for getting database field db_destination.

destinations_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_next_by_db_date_created(*, field=<django.db.models.fields.DateTimeField: db_date_created>, is_next=True, **kwargs)
get_previous_by_db_date_created(*, field=<django.db.models.fields.DateTimeField: db_date_created>, is_next=False, **kwargs)
hide_from_objects_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property home

A wrapper for getting database field db_home.

homes_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property location

Get location

locations_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

object_subscription_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <evennia.objects.manager.ObjectDBManager object>
path = 'evennia.objects.models.ObjectDB'
receiver_object_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

scriptdb_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

sender_object_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

property sessid

A wrapper for getting database field db_sessid.

typename = 'SharedMemoryModelBase'

evennia.objects.objects module

This module defines the basic DefaultObject and its children DefaultCharacter, DefaultAccount, DefaultRoom and DefaultExit. These are the (default) starting points for all in-game visible entities.

class evennia.objects.objects.DefaultCharacter(*args, **kwargs)[source]

Bases: evennia.objects.objects.DefaultObject

This implements an Object puppeted by a Session - that is, a character avatar controlled by an account.

exception DoesNotExist

Bases: evennia.objects.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.MultipleObjectsReturned

_content_types = ('character',)
_meta = <Options for DefaultCharacter>
at_after_move(source_location, **kwargs)[source]

We make sure to look around after a move.

at_post_puppet(**kwargs)[source]

Called just after puppeting has been completed and all Account<->Object links have been established.

Parameters

**kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Note

You can use self.account and self.sessions.get() to get account and sessions at this point; the last entry in the list from self.sessions.get() is the latest Session puppeting this Object.

at_post_unpuppet(account, session=None, **kwargs)[source]

We stove away the character when the account goes ooc/logs off, otherwise the character object will remain in the room also after the account logged off (“headless”, so to say).

Parameters
  • account (Account) – The account object that just disconnected from this object.

  • session (Session) – Session controlling the connection that just disconnected.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

at_pre_puppet(account, session=None, **kwargs)[source]

Return the character from storage in None location in at_post_unpuppet. :param account: This is the connecting account. :type account: Account :param session: Session controlling the connection. :type session: Session

basetype_setup()[source]

Setup character-specific security.

You should normally not need to overload this, but if you do, make sure to reproduce at least the two last commands in this method (unless you want to fundamentally change how a Character object works).

property connection_time

Returns the maximum connection time of all connected sessions in seconds. Returns nothing if there are no sessions.

classmethod create(key, account, **kwargs)[source]

Creates a basic Character with default parameters, unless otherwise specified or extended.

Provides a friendlier interface to the utils.create_character() function.

Parameters
  • key (str) – Name of the new Character.

  • account (obj) – Account to associate this Character with. Required as an argument, but one can fake it out by supplying None– it will change the default lockset and skip creator attribution.

Kwargs:

description (str): Brief description for this object. ip (str): IP address of creator (for object auditing). All other kwargs will be passed into the create_object call.

Returns

A newly created Character of the given typeclass. errors (list): A list of errors in string form, if any.

Return type

character (Object)

property idle_time

Returns the idle time of the least idle session in seconds. If no sessions are connected it returns nothing.

lockstring = 'puppet:id({character_id}) or pid({account_id}) or perm(Developer) or pperm(Developer);delete:id({account_id}) or perm(Admin)'
classmethod normalize_name(name)[source]

Normalize the character name prior to creating. Note that this should be refactored to support i18n for non-latin scripts, but as we (currently) have no bug reports requesting better support of non-latin character sets, requiring character names to be latinified is an acceptable option.

Parameters

name (str) – The name of the character

Returns

A valid name.

Return type

latin_name (str)

path = 'evennia.objects.objects.DefaultCharacter'
typename = 'DefaultCharacter'
classmethod validate_name(name)[source]

Validate the character name prior to creating. Overload this function to add custom validators

Parameters

name (str) – The name of the character

Returns

True if character creation should continue; False if it should fail

Return type

valid (bool)

class evennia.objects.objects.DefaultExit(*args, **kwargs)[source]

Bases: evennia.objects.objects.DefaultObject

This is the base exit object - it connects a location to another. This is done by the exit assigning a “command” on itself with the same name as the exit object (to do this we need to remember to re-create the command when the object is cached since it must be created dynamically depending on what the exit is called). This command (which has a high priority) will thus allow us to traverse exits simply by giving the exit-object’s name on its own.

exception DoesNotExist

Bases: evennia.objects.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.MultipleObjectsReturned

_content_types = ('exit',)
_meta = <Options for DefaultExit>
at_cmdset_get(**kwargs)[source]

Called just before cmdsets on this object are requested by the command handler. If changes need to be done on the fly to the cmdset before passing them on to the cmdhandler, this is the place to do it. This is called also if the object currently has no cmdsets.

Kwargs:
force_init (bool): If True, force a re-build of the cmdset

(for example to update aliases).

at_failed_traverse(traversing_object, **kwargs)[source]

Overloads the default hook to implement a simple default error message.

Parameters
  • traversing_object (Object) – The object that failed traversing us.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Notes

Using the default exits, this hook will not be called if an Attribute err_traverse is defined - this will in that case be read for an error string instead.

at_init()[source]

This is called when this objects is re-loaded from cache. When that happens, we make sure to remove any old ExitCmdSet cmdset (this most commonly occurs when renaming an existing exit)

at_traverse(traversing_object, target_location, **kwargs)[source]

This implements the actual traversal. The traverse lock has already been checked (in the Exit command) at this point.

Parameters
  • traversing_object (Object) – Object traversing us.

  • target_location (Object) – Where target is going.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

basetype_setup()[source]

Setup exit-security

You should normally not need to overload this - if you do make sure you include all the functionality in this method.

classmethod create(key, account, source, dest, **kwargs)[source]

Creates a basic Exit with default parameters, unless otherwise specified or extended.

Provides a friendlier interface to the utils.create_object() function.

Parameters
  • key (str) – Name of the new Exit, as it should appear from the source room.

  • account (obj) – Account to associate this Exit with.

  • source (Room) – The room to create this exit in.

  • dest (Room) – The room to which this exit should go.

Kwargs:

description (str): Brief description for this object. ip (str): IP address of creator (for object auditing).

Returns

A newly created Room of the given typeclass. errors (list): A list of errors in string form, if any.

Return type

exit (Object)

create_exit_cmdset(exidbobj)[source]

Helper function for creating an exit command set + command.

The command of this cmdset has the same name as the Exit object and allows the exit to react when the account enter the exit’s name, triggering the movement between rooms.

Parameters

exidbobj (Object) – The DefaultExit object to base the command on.

exit_command

alias of ExitCommand

lockstring = 'control:id({id}) or perm(Admin); delete:id({id}) or perm(Admin); edit:id({id}) or perm(Admin)'
path = 'evennia.objects.objects.DefaultExit'
priority = 101
typename = 'DefaultExit'
class evennia.objects.objects.DefaultObject(*args, **kwargs)[source]

Bases: evennia.objects.models.ObjectDB

This is the root typeclass object, representing all entities that have an actual presence in-game. DefaultObjects generally have a location. They can also be manipulated and looked at. Game entities you define should inherit from DefaultObject at some distance.

It is recommended to create children of this class using the evennia.create_object() function rather than to initialize the class directly - this will both set things up and efficiently save the object without obj.save() having to be called explicitly.

exception DoesNotExist

Bases: evennia.objects.models.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.models.MultipleObjectsReturned

_content_types = ('object',)
_meta = <Options for DefaultObject>
access(accessing_obj, access_type='read', default=False, no_superuser_bypass=False, **kwargs)[source]

Determines if another object has permission to access this object in whatever way.

Parameters
  • accessing_obj (Object) – Object trying to access this one.

  • access_type (str, optional) – Type of access sought.

  • default (bool, optional) – What to return if no lock of access_type was found.

  • no_superuser_bypass (bool, optional) – If True, don’t skip lock check for superuser (be careful with this one).

Kwargs:

Passed on to the at_access hook along with the result of the access check.

announce_move_from(destination, msg=None, mapping=None, **kwargs)[source]

Called if the move is to be announced. This is called while we are still standing in the old location.

Parameters
  • destination (Object) – The place we are going to.

  • msg (str, optional) – a replacement message.

  • mapping (dict, optional) – additional mapping objects.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

You can override this method and call its parent with a message to simply change the default message. In the string, you can use the following as mappings (between braces):

object: the object which is moving. exit: the exit from which the object is moving (if found). origin: the location of the object before the move. destination: the location of the object after moving.

announce_move_to(source_location, msg=None, mapping=None, **kwargs)[source]

Called after the move if the move was not quiet. At this point we are standing in the new location.

Parameters
  • source_location (Object) – The place we came from

  • msg (str, optional) – the replacement message if location.

  • mapping (dict, optional) – additional mapping objects.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Notes

You can override this method and call its parent with a message to simply change the default message. In the string, you can use the following as mappings (between braces):

object: the object which is moving. exit: the exit from which the object is moving (if found). origin: the location of the object before the move. destination: the location of the object after moving.

at_access(result, accessing_obj, access_type, **kwargs)[source]

This is called with the result of an access call, along with any kwargs used for that call. The return of this method does not affect the result of the lock check. It can be used e.g. to customize error messages in a central location or other effects based on the access result.

Parameters
  • result (bool) – The outcome of the access call.

  • accessing_obj (Object or Account) – The entity trying to gain access.

  • access_type (str) – The type of access that was requested.

Kwargs:

Not used by default, added for possible expandability in a game.

at_after_move(source_location, **kwargs)[source]

Called after move has completed, regardless of quiet mode or not. Allows changes to the object due to the location it is now in.

Parameters
  • source_location (Object) – Wwhere we came from. This may be None.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

at_after_traverse(traversing_object, source_location, **kwargs)[source]

Called just after an object successfully used this object to traverse to another object (i.e. this object is a type of Exit)

Parameters
  • traversing_object (Object) – The object traversing us.

  • source_location (Object) – Where traversing_object came from.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Notes

The target location should normally be available as self.destination.

at_before_drop(dropper, **kwargs)[source]

Called by the default drop command before this object has been dropped.

Parameters
  • dropper (Object) – The object which will drop this object.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Returns

If the object should be dropped or not.

Return type

shoulddrop (bool)

Notes

If this method returns False/None, the dropping is cancelled before it is even started.

at_before_get(getter, **kwargs)[source]

Called by the default get command before this object has been picked up.

Parameters
  • getter (Object) – The object about to get this object.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Returns

If the object should be gotten or not.

Return type

shouldget (bool)

Notes

If this method returns False/None, the getting is cancelled before it is even started.

at_before_give(giver, getter, **kwargs)[source]

Called by the default give command before this object has been given.

Parameters
  • giver (Object) – The object about to give this object.

  • getter (Object) – The object about to get this object.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Returns

If the object should be given or not.

Return type

shouldgive (bool)

Notes

If this method returns False/None, the giving is cancelled before it is even started.

at_before_move(destination, **kwargs)[source]

Called just before starting to move this object to destination.

Parameters
  • destination (Object) – The object we are moving to

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Returns

If we should move or not.

Return type

shouldmove (bool)

Notes

If this method returns False/None, the move is cancelled before it is even started.

at_before_say(message, **kwargs)[source]

Before the object says something.

This hook is by default used by the ‘say’ and ‘whisper’ commands as used by this command it is called before the text is said/whispered and can be used to customize the outgoing text from the object. Returning None aborts the command.

Parameters

message (str) – The suggested say/whisper text spoken by self.

Kwargs:
whisper (bool): If True, this is a whisper rather than

a say. This is sent by the whisper command by default. Other verbal commands could use this hook in similar ways.

receivers (Object or iterable): If set, this is the target or targets for the say/whisper.

Returns

The (possibly modified) text to be spoken.

Return type

message (str)

at_cmdset_get(**kwargs)[source]

Called just before cmdsets on this object are requested by the command handler. If changes need to be done on the fly to the cmdset before passing them on to the cmdhandler, this is the place to do it. This is called also if the object currently have no cmdsets.

Kwargs:
caller (Session, Object or Account): The caller requesting

this cmdset.

at_desc(looker=None, **kwargs)[source]

This is called whenever someone looks at this object.

Parameters
  • looker (Object, optional) – The object requesting the description.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

at_drop(dropper, **kwargs)[source]

Called by the default drop command when this object has been dropped.

Parameters
  • dropper (Object) – The object which just dropped this object.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Notes

This hook cannot stop the drop from happening. Use permissions or the at_before_drop() hook for that.

at_failed_traverse(traversing_object, **kwargs)[source]

This is called if an object fails to traverse this object for some reason.

Parameters
  • traversing_object (Object) – The object that failed traversing us.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Notes

Using the default exits, this hook will not be called if an Attribute err_traverse is defined - this will in that case be read for an error string instead.

at_first_save()[source]

This is called by the typeclass system whenever an instance of this class is saved for the first time. It is a generic hook for calling the startup hooks for the various game entities. When overloading you generally don’t overload this but overload the hooks called by this method.

at_get(getter, **kwargs)[source]

Called by the default get command when this object has been picked up.

Parameters
  • getter (Object) – The object getting this object.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Notes

This hook cannot stop the pickup from happening. Use permissions or the at_before_get() hook for that.

at_give(giver, getter, **kwargs)[source]

Called by the default give command when this object has been given.

Parameters
  • giver (Object) – The object giving this object.

  • getter (Object) – The object getting this object.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Notes

This hook cannot stop the give from happening. Use permissions or the at_before_give() hook for that.

at_init()[source]

This is always called whenever this object is initiated – that is, whenever it its typeclass is cached from memory. This happens on-demand first time the object is used or activated in some way after being created but also after each server restart or reload.

at_look(target, **kwargs)[source]

Called when this object performs a look. It allows to customize just what this means. It will not itself send any data.

Parameters
  • target (Object) – The target being looked at. This is commonly an object or the current location. It will be checked for the “view” type access.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call. This will be passed into return_appearance, get_display_name and at_desc but is not used by default.

Returns

A ready-processed look string

potentially ready to return to the looker.

Return type

lookstring (str)

at_msg_receive(text=None, from_obj=None, **kwargs)[source]

This hook is called whenever someone sends a message to this object using the msg method.

Note that from_obj may be None if the sender did not include itself as an argument to the obj.msg() call - so you have to check for this. .

Consider this a pre-processing method before msg is passed on to the user session. If this method returns False, the msg will not be passed on.

Parameters
  • text (str, optional) – The message received.

  • from_obj (any, optional) – The object sending the message.

Kwargs:

This includes any keywords sent to the msg method.

Returns

If this message should be received.

Return type

receive (bool)

Notes

If this method returns False, the msg operation will abort without sending the message.

at_msg_send(text=None, to_obj=None, **kwargs)[source]

This is a hook that is called when this object sends a message to another object with obj.msg(text, to_obj=obj).

Parameters
  • text (str, optional) – Text to send.

  • to_obj (any, optional) – The object to send to.

Kwargs:

Keywords passed from msg()

Notes

Since this method is executed by from_obj, if no from_obj was passed to DefaultCharacter.msg this hook will never get called.

at_object_creation()[source]

Called once, when this object is first created. This is the normal hook to overload for most object types.

at_object_delete()[source]

Called just before the database object is permanently delete()d from the database. If this method returns False, deletion is aborted.

at_object_leave(moved_obj, target_location, **kwargs)[source]

Called just before an object leaves from inside this object

Parameters
  • moved_obj (Object) – The object leaving

  • target_location (Object) – Where moved_obj is going.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

at_object_post_copy(new_obj, **kwargs)[source]

Called by DefaultObject.copy(). Meant to be overloaded. In case there’s extra data not covered by .copy(), this can be used to deal with it.

Parameters

new_obj (Object) – The new Copy of this object.

Returns

None

at_object_receive(moved_obj, source_location, **kwargs)[source]

Called after an object has been moved into this object.

Parameters
  • moved_obj (Object) – The object moved into this one

  • source_location (Object) – Where moved_object came from. Note that this could be None.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

at_post_puppet(**kwargs)[source]

Called just after puppeting has been completed and all Account<->Object links have been established.

Parameters

**kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Note

You can use self.account and self.sessions.get() to get account and sessions at this point; the last entry in the list from self.sessions.get() is the latest Session puppeting this Object.

at_post_unpuppet(account, session=None, **kwargs)[source]

Called just after the Account successfully disconnected from this object, severing all connections.

Parameters
  • account (Account) – The account object that just disconnected from this object.

  • session (Session) – Session id controlling the connection that just disconnected.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

at_pre_puppet(account, session=None, **kwargs)[source]

Called just before an Account connects to this object to puppet it.

Parameters
  • account (Account) – This is the connecting account.

  • session (Session) – Session controlling the connection.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

at_pre_unpuppet(**kwargs)[source]

Called just before beginning to un-connect a puppeting from this Account.

Parameters

**kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Note

You can use self.account and self.sessions.get() to get account and sessions at this point; the last entry in the list from self.sessions.get() is the latest Session puppeting this Object.

at_say(message, msg_self=None, msg_location=None, receivers=None, msg_receivers=None, **kwargs)[source]

Display the actual say (or whisper) of self.

This hook should display the actual say/whisper of the object in its location. It should both alert the object (self) and its location that some text is spoken. The overriding of messages or mapping allows for simple customization of the hook without re-writing it completely.

Parameters
  • message (str) – The message to convey.

  • msg_self (bool or str, optional) – If boolean True, echo message to self. If a string, return that message. If False or unset, don’t echo to self.

  • msg_location (str, optional) – The message to echo to self’s location.

  • receivers (Object or iterable, optional) – An eventual receiver or receivers of the message (by default only used by whispers).

  • msg_receivers (str) – Specific message to pass to the receiver(s). This will parsed with the {receiver} placeholder replaced with the given receiver.

Kwargs:
whisper (bool): If this is a whisper rather than a say. Kwargs

can be used by other verbal commands in a similar way.

mapping (dict): Pass an additional mapping to the message.

Notes

Messages can contain {} markers. These are substituted against the values passed in the mapping argument.

msg_self = ‘You say: “{speech}”’ msg_location = ‘{object} says: “{speech}”’ msg_receivers = ‘{object} whispers: “{speech}”’

Supported markers by default:

{self}: text to self-reference with (default ‘You’) {speech}: the text spoken/whispered by self. {object}: the object speaking. {receiver}: replaced with a single receiver only for strings meant for a specific

receiver (otherwise ‘None’).

{all_receivers}: comma-separated list of all receivers,

if more than one, otherwise same as receiver

{location}: the location where object is.

at_server_reload()[source]

This hook is called whenever the server is shutting down for restart/reboot. If you want to, for example, save non-persistent properties across a restart, this is the place to do it.

at_server_shutdown()[source]

This hook is called whenever the server is shutting down fully (i.e. not for a restart).

at_traverse(traversing_object, target_location, **kwargs)[source]

This hook is responsible for handling the actual traversal, normally by calling traversing_object.move_to(target_location). It is normally only implemented by Exit objects. If it returns False (usually because move_to returned False), at_after_traverse below should not be called and instead at_failed_traverse should be called.

Parameters
  • traversing_object (Object) – Object traversing us.

  • target_location (Object) – Where target is going.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

basetype_posthook_setup()[source]

Called once, after basetype_setup and at_object_creation. This should generally not be overloaded unless you are redefining how a room/exit/object works. It allows for basetype-like setup after the object is created. An example of this is EXITs, who need to know keys, aliases, locks etc to set up their exit-cmdsets.

basetype_setup()[source]

This sets up the default properties of an Object, just before the more general at_object_creation.

You normally don’t need to change this unless you change some fundamental things like names of permission groups.

clear_contents()[source]

Moves all objects (accounts/things) to their home location or to default home.

clear_exits()[source]

Destroys all of the exits and any exits pointing to this object as a destination.

cmdset[source]
property contents

Returns the contents of this object, i.e. all objects that has this object set as its location. This should be publically available.

Parameters
  • exclude (Object) – Object to exclude from returned contents list

  • content_type (str) – A content_type to filter by. None for no filtering.

Returns

List of contents of this Object.

Return type

contents (list)

Notes

Also available as the contents property, minus exclusion and filtering.

contents_get(exclude=None, content_type=None)[source]

Returns the contents of this object, i.e. all objects that has this object set as its location. This should be publically available.

Parameters
  • exclude (Object) – Object to exclude from returned contents list

  • content_type (str) – A content_type to filter by. None for no filtering.

Returns

List of contents of this Object.

Return type

contents (list)

Notes

Also available as the contents property, minus exclusion and filtering.

contents_set(*args)[source]

You cannot replace this property

copy(new_key=None, **kwargs)[source]

Makes an identical copy of this object, identical except for a new dbref in the database. If you want to customize the copy by changing some settings, use ObjectDB.object.copy_object() directly.

Parameters

new_key (string) – New key/name of copied object. If new_key is not specified, the copy will be named <old_key>_copy by default.

Returns

A copy of this object.

Return type

copy (Object)

classmethod create(key, account=None, **kwargs)[source]

Creates a basic object with default parameters, unless otherwise specified or extended.

Provides a friendlier interface to the utils.create_object() function.

Parameters
  • key (str) – Name of the new object.

  • account (Account) – Account to attribute this object to.

Kwargs:

description (str): Brief description for this object. ip (str): IP address of creator (for object auditing).

Returns

A newly created object of the given typeclass. errors (list): A list of errors in string form, if any.

Return type

object (Object)

delete()[source]

Deletes this object. Before deletion, this method makes sure to move all contained objects to their respective home locations, as well as clean up all exits to/from the object.

Returns

Returns whether or not the delete completed

successfully or not.

Return type

noerror (bool)

execute_cmd(raw_string, session=None, **kwargs)[source]

Do something as this object. This is never called normally, it’s only used when wanting specifically to let an object be the caller of a command. It makes use of nicks of eventual connected accounts as well.

Parameters
  • raw_string (string) – Raw command input

  • session (Session, optional) – Session to return results to

Kwargs:

Other keyword arguments will be added to the found command object instace as variables before it executes. This is unused by default Evennia but may be used to set flags and change operating paramaters for commands at run-time.

Returns

This is an asynchronous Twisted object that

will not fire until the command has actually finished executing. To overload this one needs to attach callback functions to it, with addCallback(function). This function will be called with an eventual return value from the command execution. This return is not used at all by Evennia by default, but might be useful for coders intending to implement some sort of nested command structure.

Return type

defer (Deferred)

property exits

Returns all exits from this object, i.e. all objects at this location having the property destination != None.

for_contents(func, exclude=None, **kwargs)[source]

Runs a function on every object contained within this one.

Parameters
  • func (callable) – Function to call. This must have the formal call sign func(obj, **kwargs), where obj is the object currently being processed and **kwargs are passed on from the call to for_contents.

  • exclude (list, optional) – A list of object not to call the function on.

Kwargs:

Keyword arguments will be passed to the function for all objects.

get_display_name(looker, **kwargs)[source]

Displays the name of the object in a viewer-aware manner.

Parameters

looker (TypedObject) – The object or account that is looking at/getting inforamtion for this object.

Returns

A string containing the name of the object,

including the DBREF if this user is privileged to control said object.

Return type

name (str)

Notes

This function could be extended to change how object names appear to users in character, but be wary. This function does not change an object’s keys or aliases when searching, and is expected to produce something useful for builders.

get_numbered_name(count, looker, **kwargs)[source]

Return the numbered (singular, plural) forms of this object’s key. This is by default called by return_appearance and is used for grouping multiple same-named of this object. Note that this will be called on every member of a group even though the plural name will be only shown once. Also the singular display version, such as ‘an apple’, ‘a tree’ is determined from this method.

Parameters
  • count (int) – Number of objects of this type

  • looker (Object) – Onlooker. Not used by default.

Kwargs:

key (str): Optional key to pluralize, if given, use this instead of the object’s key.

Returns

The singular form to display. plural (str): The determined plural form of the key, including the count.

Return type

singular (str)

property has_account

Convenience property for checking if an active account is currently connected to this object.

property is_connected
property is_superuser

Check if user has an account, and if so, if it is a superuser.

lockstring = 'control:id({account_id}) or perm(Admin);delete:id({account_id}) or perm(Admin)'
move_to(destination, quiet=False, emit_to_obj=None, use_destination=True, to_none=False, move_hooks=True, **kwargs)[source]

Moves this object to a new location.

Parameters
  • destination (Object) – Reference to the object to move to. This can also be an exit object, in which case the destination property is used as destination.

  • quiet (bool) – If true, turn off the calling of the emit hooks (announce_move_to/from etc)

  • emit_to_obj (Object) – object to receive error messages

  • use_destination (bool) – Default is for objects to use the “destination” property of destinations as the target to move to. Turning off this keyword allows objects to move “inside” exit objects.

  • to_none (bool) – Allow destination to be None. Note that no hooks are run when moving to a None location. If you want to run hooks, run them manually (and make sure they can manage None locations).

  • move_hooks (bool) – If False, turn off the calling of move-related hooks (at_before/after_move etc) with quiet=True, this is as quiet a move as can be done.

Kwargs:

Passed on to announce_move_to and announce_move_from hooks.

Returns

True/False depending on if there were problems with the move.

This method may also return various error messages to the emit_to_obj.

Return type

result (bool)

Notes

No access checks are done in this method, these should be handled before calling move_to.

The DefaultObject hooks called (if move_hooks=True) are, in order:

  1. self.at_before_move(destination) (if this returns False, move is aborted)

  2. source_location.at_object_leave(self, destination)

  3. self.announce_move_from(destination)

  4. (move happens here)

  5. self.announce_move_to(source_location)

  6. destination.at_object_receive(self, source_location)

  7. self.at_after_move(source_location)

msg(text=None, from_obj=None, session=None, options=None, **kwargs)[source]

Emits something to a session attached to the object.

Parameters
  • text (str or tuple, optional) – The message to send. This is treated internally like any send-command, so its value can be a tuple if sending multiple arguments to the text oob command.

  • from_obj (obj or list, optional) – object that is sending. If given, at_msg_send will be called. This value will be passed on to the protocol. If iterable, will execute hook on all entities in it.

  • session (Session or list, optional) – Session or list of Sessions to relay data to, if any. If set, will force send to these sessions. If unset, who receives the message depends on the MULTISESSION_MODE.

  • options (dict, optional) – Message-specific option-value pairs. These will be applied at the protocol level.

Kwargs:
any (string or tuples): All kwarg keys not listed above

will be treated as send-command names and their arguments (which can be a string or a tuple).

Notes

at_msg_receive will be called on this Object. All extra kwargs will be passed on to the protocol.

msg_contents(text=None, exclude=None, from_obj=None, mapping=None, **kwargs)[source]

Emits a message to all objects inside this object.

Parameters
  • text (str or tuple) – Message to send. If a tuple, this should be on the valid OOB outmessage form (message, {kwargs}), where kwargs are optional data passed to the text outputfunc.

  • exclude (list, optional) – A list of objects not to send to.

  • from_obj (Object, optional) – An object designated as the “sender” of the message. See DefaultObject.msg() for more info.

  • mapping (dict, optional) – A mapping of formatting keys {“key”:<object>, “key2”:<object2>,…}. The keys must match `{key} markers in the text if this is a string or in the internal message if text is a tuple. These formatting statements will be replaced by the return of <object>.get_display_name(looker) for every looker in contents that receives the message. This allows for every object to potentially get its own customized string.

Kwargs:

Keyword arguments will be passed on to obj.msg() for all messaged objects.

Notes

The mapping argument is required if message contains {}-style format syntax. The keys of mapping should match named format tokens, and its values will have their get_display_name() function called for each object in the room before substitution. If an item in the mapping does not have get_display_name(), its string value will be used.

Example

Say Char is a Character object and Npc is an NPC object:

char.location.msg_contents(

“{attacker} kicks {defender}”, mapping=dict(attacker=char, defender=npc), exclude=(char, npc))

This will result in everyone in the room seeing ‘Char kicks NPC’ where everyone may potentially see different results for Char and Npc depending on the results of char.get_display_name(looker) and npc.get_display_name(looker) for each particular onlooker

nicks[source]
objects = <evennia.objects.manager.ObjectManager object>
path = 'evennia.objects.objects.DefaultObject'
return_appearance(looker, **kwargs)[source]

This formats a description. It is the hook a ‘look’ command should call.

Parameters
  • looker (Object) – Object doing the looking.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

scripts[source]
search(searchdata, global_search=False, use_nicks=True, typeclass=None, location=None, attribute_name=None, quiet=False, exact=False, candidates=None, nofound_string=None, multimatch_string=None, use_dbref=None)[source]

Returns an Object matching a search string/condition

Perform a standard object search in the database, handling multiple results and lack thereof gracefully. By default, only objects in the current location of self or its inventory are searched for.

Parameters
  • searchdata (str or obj) –

    Primary search criterion. Will be matched against object.key (with object.aliases second) unless the keyword attribute_name specifies otherwise. Special strings: - #<num>: search by unique dbref. This is always

    a global search.

    • me,self: self-reference to this object

    • <num>-<string> - can be used to differentiate

      between multiple same-named matches

  • global_search (bool) – Search all objects globally. This is overruled by location keyword.

  • use_nicks (bool) – Use nickname-replace (nicktype “object”) on searchdata.

  • typeclass (str or Typeclass, or list of either) – Limit search only to Objects with this typeclass. May be a list of typeclasses for a broader search.

  • location (Object or list) – Specify a location or multiple locations to search. Note that this is used to query the contents of a location and will not match for the location itself - if you want that, don’t set this or use candidates to specify exactly which objects should be searched.

  • attribute_name (str) – Define which property to search. If set, no key+alias search will be performed. This can be used to search database fields (db_ will be automatically prepended), and if that fails, it will try to return objects having Attributes with this name and value equal to searchdata. A special use is to search for “key” here if you want to do a key-search without including aliases.

  • quiet (bool) – don’t display default error messages - this tells the search method that the user wants to handle all errors themselves. It also changes the return value type, see below.

  • exact (bool) – if unset (default) - prefers to match to beginning of string rather than not matching at all. If set, requires exact matching of entire string.

  • candidates (list of objects) – this is an optional custom list of objects to search (filter) between. It is ignored if global_search is given. If not set, this list will automatically be defined to include the location, the contents of location and the caller’s contents (inventory).

  • nofound_string (str) – optional custom string for not-found error message.

  • multimatch_string (str) – optional custom string for multimatch error header.

  • use_dbref (bool or None, optional) – If True, allow to enter e.g. a query “#123” to find an object (globally) by its database-id 123. If False, the string “#123” will be treated like a normal string. If None (default), the ability to query by #dbref is turned on if self has the permission ‘Builder’ and is turned off otherwise.

Returns

will return an Object/None if quiet=False,

otherwise it will return a list of 0, 1 or more matches.

Return type

match (Object, None or list)

Notes

To find Accounts, use eg. evennia.account_search. If quiet=False, error messages will be handled by settings.SEARCH_AT_RESULT and echoed automatically (on error, return will be None). If quiet=True, the error messaging is assumed to be handled by the caller.

search_account(searchdata, quiet=False)[source]

Simple shortcut wrapper to search for accounts, not characters.

Parameters
  • searchdata (str) – Search criterion - the key or dbref of the account to search for. If this is “here” or “me”, search for the account connected to this object.

  • quiet (bool) – Returns the results as a list rather than echo eventual standard error messages. Default False.

Returns

Just what is returned depends on
the quiet setting:
  • quiet=True: No match or multumatch auto-echoes errors to self.msg, then returns None. The esults are passed through settings.SEARCH_AT_RESULT and settings.SEARCH_AT_MULTIMATCH_INPUT. If there is a unique match, this will be returned.

  • quiet=True: No automatic error messaging is done, and what is returned is always a list with 0, 1 or more matching Accounts.

Return type

result (Account, None or list)

sessions[source]
typename = 'DefaultObject'
class evennia.objects.objects.DefaultRoom(*args, **kwargs)[source]

Bases: evennia.objects.objects.DefaultObject

This is the base room object. It’s just like any Object except its location is always None.

exception DoesNotExist

Bases: evennia.objects.objects.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.MultipleObjectsReturned

_content_types = ('room',)
_meta = <Options for DefaultRoom>
basetype_setup()[source]

Simple room setup setting locks to make sure the room cannot be picked up.

classmethod create(key, account, **kwargs)[source]

Creates a basic Room with default parameters, unless otherwise specified or extended.

Provides a friendlier interface to the utils.create_object() function.

Parameters
  • key (str) – Name of the new Room.

  • account (obj) – Account to associate this Room with.

Kwargs:

description (str): Brief description for this object. ip (str): IP address of creator (for object auditing).

Returns

A newly created Room of the given typeclass. errors (list): A list of errors in string form, if any.

Return type

room (Object)

lockstring = 'control:id({id}) or perm(Admin); delete:id({id}) or perm(Admin); edit:id({id}) or perm(Admin)'
path = 'evennia.objects.objects.DefaultRoom'
typename = 'DefaultRoom'
class evennia.objects.objects.ExitCommand(**kwargs)[source]

Bases: evennia.commands.command.Command

This is a command that simply cause the caller to traverse the object it is attached to.

_keyaliases = ('command',)
_matchset = {'command'}
aliases = []
func()[source]

Default exit traverse if no syscommand is defined.

get_extra_info(caller, **kwargs)[source]

Shows a bit of information on where the exit leads.

Parameters
  • caller (Object) – The object (usually a character) that entered an ambiguous command.

  • **kwargs (dict) – Arbitrary, optional arguments for users overriding the call (unused by default).

Returns

A string with identifying information to disambiguate the command, conventionally with a preceding space.

help_category = 'general'
key = 'command'
lock_storage = 'cmd:all();'
obj = None
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'tags': '', 'text': '\n This is a command that simply cause the caller to traverse\n the object it is attached to.\n\n '}
class evennia.objects.objects.ObjectSessionHandler(obj)[source]

Bases: object

Handles the get/setting of the sessid comma-separated integer field

__init__(obj)[source]

Initializes the handler.

Parameters

obj (Object) – The object on which the handler is defined.

_recache()[source]
add(session)[source]

Add session to handler.

Parameters

session (Session or int) – Session or session id to add.

Notes

We will only add a session/sessid if this actually also exists in the the core sessionhandler.

all()[source]

Alias to get(), returning all sessions.

Returns

All sessions.

Return type

sessions (list)

clear()[source]

Clear all handled sessids.

count()[source]

Get amount of sessions connected.

Returns

Number of sessions handled.

Return type

sesslen (int)

get(sessid=None)[source]

Get the sessions linked to this Object.

Parameters

sessid (int, optional) – A specific session id.

Returns

The sessions connected to this object. If sessid is given,

this is a list of one (or zero) elements.

Return type

sessions (list)

Notes

Aliased to self.all().

remove(session)[source]

Remove session from handler.

Parameters

session (Session or int) – Session or session id to remove.

evennia.objects.tests module

class evennia.objects.tests.DefaultObjectTest(methodName='runTest')[source]

Bases: evennia.utils.test_resources.EvenniaTest

ip = '212.216.139.14'
test_character_create()[source]
test_character_create_noaccount()[source]
test_character_create_weirdname()[source]
test_exit_create()[source]
test_object_create()[source]
test_room_create()[source]
test_urls()[source]

Make sure objects are returning URLs

class evennia.objects.tests.TestContentHandler(methodName='runTest')[source]

Bases: evennia.utils.test_resources.EvenniaTest

Test the ContentHandler (obj.contents)

test_content_type()[source]
test_object_create_remove()[source]

Create/destroy object

test_object_move()[source]

Move object from room to room in various ways

class evennia.objects.tests.TestObjectManager(methodName='runTest')[source]

Bases: evennia.utils.test_resources.EvenniaTest

Test object manager methods

test_copy_object()[source]

Test that all attributes and tags properly copy across objects

test_get_object_with_account()[source]
test_get_objs_with_attr()[source]
test_get_objs_with_key_and_typeclass()[source]