evennia.contrib.slow_exit

Slow Exit typeclass

Contribution - Griatch 2014

This is an example of an Exit-type that delays its traversal.This simulates slow movement, common in many different types of games. The contrib also contains two commands, CmdSetSpeed and CmdStop for changing the movement speed and abort an ongoing traversal, respectively.

To try out an exit of this type, you could connect two existing rooms using something like this:

@open north:contrib.slow_exit.SlowExit = <destination>

Installation:

To make this your new default exit, modify mygame/typeclasses/exits.py to import this module and change the default Exit class to inherit from SlowExit instead.

To get the ability to change your speed and abort your movement, simply import and add CmdSetSpeed and CmdStop from this module to your default cmdset (see tutorials on how to do this if you are unsure).

Notes:

This implementation is efficient but not persistent; so incomplete movement will be lost in a server reload. This is acceptable for most game types - to simulate longer travel times (more than the couple of seconds assumed here), a more persistent variant using Scripts or the TickerHandler might be better.

class evennia.contrib.slow_exit.SlowExit(*args, **kwargs)[source]

Bases: evennia.objects.objects.DefaultExit

This overloads the way moving happens.

at_traverse(traversing_object, target_location)[source]

Implements the actual traversal, using utils.delay to delay the move_to.

exception DoesNotExist

Bases: evennia.objects.objects.DefaultExit.DoesNotExist

exception MultipleObjectsReturned

Bases: evennia.objects.objects.DefaultExit.MultipleObjectsReturned

path = 'evennia.contrib.slow_exit.SlowExit'
typename = 'SlowExit'
class evennia.contrib.slow_exit.CmdSetSpeed(**kwargs)[source]

Bases: evennia.commands.command.Command

set your movement speed

Usage:

setspeed stroll|walk|run|sprint

This will set your movement speed, determining how long time it takes to traverse exits. If no speed is set, ‘walk’ speed is assumed.

key = 'setspeed'
func()[source]

Simply sets an Attribute used by the SlowExit above.

aliases = []
help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'setspeed', 'tags': '', 'text': "\n set your movement speed\n\n Usage:\n setspeed stroll|walk|run|sprint\n\n This will set your movement speed, determining how long time\n it takes to traverse exits. If no speed is set, 'walk' speed\n is assumed.\n "}
class evennia.contrib.slow_exit.CmdStop(**kwargs)[source]

Bases: evennia.commands.command.Command

stop moving

Usage:

stop

Stops the current movement, if any.

key = 'stop'
func()[source]

This is a very simple command, using the stored deferred from the exit traversal above.

aliases = []
help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'stop', 'tags': '', 'text': '\n stop moving\n\n Usage:\n stop\n\n Stops the current movement, if any.\n '}