More fixes and cleanup in wake of ic/ooc changes.

This commit is contained in:
Griatch 2011-11-06 23:55:24 +01:00
parent 86f76d0d08
commit 3e8b43d222
9 changed files with 66 additions and 40 deletions

View file

@ -22,9 +22,9 @@ from src.commands.cmdset import CmdSet
from src.commands.default import cmdset_default, cmdset_unloggedin, cmdset_ooc
from game.gamesrc.commands.basecommand import Command
from contrib import menusystem, lineeditor
#from contrib import menusystem, lineeditor
#from contrib import misc_commands
from contrib import chargen
#from contrib import chargen, menu_login
class DefaultCmdSet(cmdset_default.DefaultCmdSet):
"""
@ -48,7 +48,7 @@ class DefaultCmdSet(cmdset_default.DefaultCmdSet):
#
# any commands you add below will overload the default ones.
#
self.add(menusystem.CmdMenuTest())
#self.add(menusystem.CmdMenuTest())
#self.add(lineeditor.CmdEditor())
#self.add(misc_commands.CmdQuell())
@ -92,8 +92,7 @@ class OOCCmdSet(cmdset_ooc.OOCCmdSet):
#
# any commands you add below will overload the default ones.
#
self.add(chargen.OOCCmdSetCharGen)
#
class BaseCmdSet(CmdSet):
"""

View file

@ -99,37 +99,13 @@ class Object(BaseObject):
class Character(BaseCharacter):
"""
This is the default object created for a new user connecting - the
in-game player character representation. Note that it's important
that at_object_creation sets up an script that adds the Default
command set whenever the player logs in - otherwise they won't be
able to use any commands!
in-game player character representation. The basetype_setup always
assigns the default_cmdset as a fallback to objects of this type.
The default hooks also hide the character object away (by moving
it to a Null location whenever the player logs off (otherwise the
character would remain in the world, "headless" so to say).
"""
def at_disconnect(self):
"""
We stove away the character when logging off, otherwise the character object will
remain in the room also after the player logged off ("headless", so to say).
"""
if self.location: # have to check, in case of multiple connections closing
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:
# try to recover
self.location = self.db.prelogout_location
if self.location == None:
# make sure location is never None (home should always exist)
self.location = self.home
# save location again to be sure
self.db.prelogout_location = self.location
self.location.msg_contents("%s has entered the game." % self.name, exclude=[self])
self.location.at_object_receive(self, self.location)
pass
class Room(BaseRoom):
"""