Further fixes to the system, still some issues remaining.

This commit is contained in:
Griatch 2013-04-06 21:36:52 +02:00
parent 9eb1903f02
commit 20a57d4167
7 changed files with 119 additions and 69 deletions

View file

@ -61,7 +61,7 @@ def create_objects():
god_character.save()
god_character.set_attribute("_superuser_character", True)
gor_character.set_attribute("_first_login", True)
god_character.set_attribute("_first_login", True)
# Limbo is the default "nowhere" starting room

View file

@ -272,7 +272,7 @@ class Evennia(object):
yield [(o.typeclass, o.at_server_shutdown()) for o in ObjectDB.get_all_cached_instances()]
else: # shutdown
yield [_SA(p, "is_connected", False) for p in PlayerDB.get_all_cached_instances()]
yield [(o.typeclass, o.at_disconnect(), o.at_server_shutdown()) for o in ObjectDB.get_all_cached_instances()]
yield [(o.typeclass, o.at_server_shutdown()) for o in ObjectDB.get_all_cached_instances()]
yield [(p.typeclass, p.at_server_shutdown()) for p in PlayerDB.get_all_cached_instances()]
yield [(s.typeclass, s.at_server_shutdown()) for s in ScriptDB.get_all_cached_instances()]

View file

@ -17,6 +17,7 @@ from src.commands import cmdhandler, cmdsethandler
from src.server.session import Session
IDLE_COMMAND = settings.IDLE_COMMAND
_GA = object.__getattribute__
# load optional out-of-band function module
OOB_FUNC_MODULE = settings.OOB_FUNC_MODULE
@ -57,7 +58,7 @@ class ServerSession(Session):
self.cmdset.update(init_mode=True)
return
else:
self.player.reconnect_session_to_character(self.sessid)
self.player.server_reconnect_session_to_character(self.sessid)
def at_login(self, player):
"""
@ -83,17 +84,18 @@ class ServerSession(Session):
if self.logged_in:
sessid = self.sessid
player = self.player
if player.get_character(sessid):
player.disconnect_session_from_character(sessid)
uaccount = player.user
print "session at_disconnect", self
_GA(player.dbobj, "disconnect_session_from_character")(sessid)
uaccount = _GA(player.dbobj, "user")
uaccount.last_login = datetime.now()
uaccount.save()
# calling player hook
_GA(player.typeclass, "at_disconnect")()
self.logged_in = False
if not self.sessionhandler.sessions_from_player(player):
# no more sessions connected to this player
player.is_connected = False
def get_player(self):
"""
Get the player associated with this session