Migration needed. Refactored the config.configValue model into server.ServerConfig (that's what the config model were used for anyway). The new model can handle arbitrary data structures through pickle. Run ./manage.py migrate to sync your database with the new setup.

Moved Connect screens (the text screen first seen when connecting) away from the database and into a module in gamesrc/world. This module allows for conveniently adding new connect screens on the fly. More than one screen in the given module will mean a random screen is used.
This commit is contained in:
Griatch 2011-04-12 21:43:57 +00:00
parent f1404356ea
commit 7f9f21f45e
21 changed files with 162 additions and 257 deletions

View file

@ -17,7 +17,7 @@ registering themselves with this module.
"""
from django.conf import settings
from django.contrib.auth.models import User
from src.config.models import ConfigValue
from src.server.models import ServerConfig
ALLOW_MULTISESSION = settings.ALLOW_MULTISESSION
@ -144,15 +144,15 @@ class SessionHandler(object):
"""
if num == None:
# show the current value. This also syncs it.
return int(ConfigValue.objects.conf('nr_sessions', default=0))
return int(ServerConfig.objects.conf('nr_sessions', default=0))
elif num == 0:
# reset value to 0
ConfigValue.objects.conf('nr_sessions', 0)
ServerConfig.objects.conf('nr_sessions', 0)
else:
# add/remove session count from value
add = int(ConfigValue.objects.conf('nr_sessions', default=0))
add = int(ServerConfig.objects.conf('nr_sessions', default=0))
num = max(0, num + add)
ConfigValue.objects.conf('nr_sessions', str(num))
ServerConfig.objects.conf('nr_sessions', str(num))
def player_count(self):
"""