Removed DEFAULT_HOME from settings.py into a server configuration directive via the confg app.

Changed clear_objects to reflect default home changes.
This commit is contained in:
Michael King 2007-08-07 16:52:47 +00:00
parent 8b8099a9db
commit 0c2648edaa
3 changed files with 12 additions and 10 deletions

View file

@ -4,3 +4,4 @@ INSERT INTO config_configvalue VALUES(3,'money_name_plural','Credits');
INSERT INTO config_configvalue VALUES(4,'money_name_singular','Credit');
INSERT INTO config_configvalue VALUES(5,'game_firstrun','1');
INSERT INTO config_configvalue VALUES(6,'idle_timeout','1800');
INSERT INTO config_configvalue VALUES(7,'default_home','2');

View file

@ -5,6 +5,7 @@ from django.contrib.auth.models import User, Group
import scripthandler
import defines_global
import gameconf
import ansi
class Attribute(models.Model):
@ -427,6 +428,11 @@ class Object(models.Model):
# Gather up everything, other than exits and going/garbage, that is under
# the belief this is its location.
objs = self.obj_location.filter(type__in=[1,2,3])
default_home_id = gameconf.get_configvalue('default_home')
try:
default_home = Object.objects.get(id=default_home_id)
except:
functions_general.log_errmsg("Could not find default home '(#%d)'." % (default_home_id))
for obj in objs:
home = obj.get_home()
@ -437,13 +443,13 @@ class Object(models.Model):
# Obviously, we can't send it back to here.
if home is self:
home = None
obj.home = default_home
obj.save()
home = default_home
# If for some reason it's still None...
if not home:
try:
home = Object.objects.get(id=defines_global.DEFAULT_HOME)
except:
functions_general.log_errmsg("Could not find default home '(#%d)' for %s '%s(#%d)'." % (defines_global.DEFAULT_HOME, text, obj.name, obj.id))
functions_general.log_errmsg("Missing default home, %s '%s(#%d)' now has a null location." % (text, obj.name, obj.id))
if obj.is_player():
if obj.is_connected():

View file

@ -1,11 +1,6 @@
# A list of ports to listen on. Can be one or many.
GAMEPORTS = [4000]
# The integer dbref of a home for objects that become homeless. This is the room
# where new players start. NOTE: This is based on the default data. If you delete
# #2, you will want to change this.
DEFAULT_HOME = 2
# While DEBUG is False, show a regular server error page on the web stuff,
# email the traceback to the people in the ADMINS tuple below. By default (True),
# show a detailed traceback for the web browser to display.