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:
parent
745df8356f
commit
c29649cd53
2 changed files with 22 additions and 1 deletions
|
|
@ -95,6 +95,25 @@ class Character(BaseCharacter):
|
||||||
# expand with whatever customizations you want below...
|
# 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):
|
class Room(BaseRoom):
|
||||||
"""
|
"""
|
||||||
Rooms are like any object, except their location is None
|
Rooms are like any object, except their location is None
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ class Player(TypeClass):
|
||||||
to store attributes all players should have,
|
to store attributes all players should have,
|
||||||
like configuration values etc.
|
like configuration values etc.
|
||||||
"""
|
"""
|
||||||
|
# the text encoding to use.
|
||||||
|
self.db.encoding = "utf-8"
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Note that the hooks below also exist
|
# Note that the hooks below also exist
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue