Added new templates to gamesrc/*/examples. The old base* modules still in place. Some cleanup of the API.
This commit is contained in:
parent
3408f3ca3f
commit
4398d42360
12 changed files with 686 additions and 11 deletions
41
game/gamesrc/objects/examples/character.py
Normal file
41
game/gamesrc/objects/examples/character.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
"""
|
||||
|
||||
Template for Characters
|
||||
|
||||
Copy this module up one level and name it as you like, then
|
||||
use it as a template to create your own Character class.
|
||||
|
||||
To make new logins default to creating characters
|
||||
of your new type, change settings.BASE_CHARACTER_TYPECLASS to point to
|
||||
your new class, e.g.
|
||||
|
||||
settings.BASE_CHARACTER_TYPECLASS = "game.gamesrc.objects.mychar.MyChar"
|
||||
|
||||
Note that objects already created in the database will not notice
|
||||
this change, you have to convert them manually e.g. with the
|
||||
@typeclass command.
|
||||
|
||||
"""
|
||||
from ev import Character
|
||||
|
||||
class ExampleCharacter(Character):
|
||||
"""
|
||||
The Character is like any normal Object (see example/object.py for
|
||||
a list of properties and methods), except it actually implements
|
||||
some of its hook methods to do some work:
|
||||
|
||||
at_basetype_setup - always assigns the default_cmdset to this object type
|
||||
(important!)sets locks so character cannot be picked up
|
||||
and its commands only be called by itself, not anyone else.
|
||||
(to change things, use at_object_creation() instead)
|
||||
at_after_move - launches the "look" command
|
||||
at_disconnect - stores the current location, so the "unconnected" character
|
||||
object does not need to stay on grid but can be given a
|
||||
None-location while offline.
|
||||
at_post_login - retrieves the character's old location and puts it back
|
||||
on the grid with a "charname has connected" message echoed
|
||||
to the room
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue