Made characters disappear from the room when their controlling player logs off. This is a trivial thing to customize, but the old default (leave the character objects in the room, although "headless") confused people.

This commit is contained in:
Griatch 2010-10-03 19:49:48 +00:00
parent 745df8356f
commit c29649cd53
2 changed files with 22 additions and 1 deletions

View file

@ -94,6 +94,25 @@ class Character(BaseCharacter):
# expand with whatever customizations you want below...
# ...
def at_disconnect(self):
"""
We stove away the character when logging off, otherwise they will remain where
they are, 'headless', so to say.
"""
self.location.msg_contents("%s has left the game." % self.name)
self.db.prelogout_location = self.location
self.location = None
def at_post_login(self):
"""
This recovers the character again after having been "stoved away" at disconnect.
"""
if self.db.prelogout_location:
self.location = self.db.prelogout_location
else:
self.db.prelogout_location = self.location
self.location.msg_contents("%s has entered the game." % self.name)
class Room(BaseRoom):
"""

View file

@ -24,7 +24,9 @@ class Player(TypeClass):
register with the game). It's a good place
to store attributes all players should have,
like configuration values etc.
"""
"""
# the text encoding to use.
self.db.encoding = "utf-8"
pass
# Note that the hooks below also exist