evennia / evennia

Python MUD/MUX/MUSH/MU* development system

Home Page:http://www.evennia.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Documentation] "7.3. Modifying ourselves" change for updated code in new version of Evennia

BurrowsForge opened this issue · comments

Existing page / new

Exiting page of the tutorial located at https://www.evennia.com/docs/latest/Howtos/Beginner-Tutorial/Part1/Beginner-Tutorial-Learning-Typeclasses.html

Documentation issue

7.3. Modifying ourselves
Let’s try to modify ourselves a little. Open up mygame/typeclasses/characters.py.

"""
(module docstring)
"""
from evennia import DefaultCharacter

class Character(DefaultCharacter):
"""
(class docstring)
"""
pass

This does not reflect what is currently in the mygame/typeclasses/characters.py. This can be confusing when you are trying to follow along with your own game.

Suggested change

This is what is currently in mygame/typeclasses/characters.py. A lot of the changes are comments but evennia now also call more than one parent now, (ObjectParent, DefaultCharacter). This could also affect the explanation and guidance on the page as well.

"""
Characters

Characters are (by default) Objects setup to be puppeted by Accounts.
They are what you "see" in game. The Character class in this module
is setup to be the "default" character type created by the default
creation commands.

"""
from evennia.objects.objects import DefaultCharacter

from .objects import ObjectParent

class Character(ObjectParent, DefaultCharacter):
"""
The Character defaults to reimplementing some of base Object's hook methods with the
following functionality:

at_basetype_setup - always assigns the DefaultCmdSet 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_post_move(source_location) - Launches the "look" command after every move.
at_post_unpuppet(account) -  when Account disconnects from the Character, we
                store the current location in the pre_logout_location Attribute and
                move it to a None-location so the "unpuppeted" character
                object does not need to stay on grid. Echoes "Account has disconnected"
                to the room.
at_pre_puppet - Just before Account re-connects, retrieves the character's
                pre_logout_location Attribute and move it back on the grid.
at_post_puppet - Echoes "AccountName has entered the game" to the room.

"""

pass