Run Migrations! Added a is_connected field to Players to be able to more conveniently access online status from out-of-process (resolves issue 251). Also cleaned up and added features to the default website.

This commit is contained in:
Griatch 2012-09-17 19:19:20 +02:00
parent c53a9b5770
commit 21137cc830
10 changed files with 189 additions and 75 deletions

View file

@ -21,6 +21,7 @@ import django
from django.db import connection
from django.conf import settings
from src.players.models import PlayerDB
from src.scripts.models import ScriptDB
from src.server.models import ServerConfig
from src.server import initial_setup
@ -29,6 +30,8 @@ from src.utils.utils import get_evennia_version, mod_import
from src.comms import channelhandler
from src.server.sessionhandler import SESSIONS
_SA = object.__setattr__
if os.name == 'nt':
# For Windows we need to handle pid files manually.
SERVER_PIDFILE = os.path.join(settings.GAME_DIR, 'server.pid')
@ -285,6 +288,7 @@ class Evennia(object):
# don't call disconnect hooks on reset
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 [(p.typeclass, p.at_server_shutdown()) for p in PlayerDB.get_all_cached_instances()]