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:
parent
8b8099a9db
commit
0c2648edaa
3 changed files with 12 additions and 10 deletions
|
|
@ -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(4,'money_name_singular','Credit');
|
||||||
INSERT INTO config_configvalue VALUES(5,'game_firstrun','1');
|
INSERT INTO config_configvalue VALUES(5,'game_firstrun','1');
|
||||||
INSERT INTO config_configvalue VALUES(6,'idle_timeout','1800');
|
INSERT INTO config_configvalue VALUES(6,'idle_timeout','1800');
|
||||||
|
INSERT INTO config_configvalue VALUES(7,'default_home','2');
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ from django.contrib.auth.models import User, Group
|
||||||
|
|
||||||
import scripthandler
|
import scripthandler
|
||||||
import defines_global
|
import defines_global
|
||||||
|
import gameconf
|
||||||
import ansi
|
import ansi
|
||||||
|
|
||||||
class Attribute(models.Model):
|
class Attribute(models.Model):
|
||||||
|
|
@ -427,6 +428,11 @@ class Object(models.Model):
|
||||||
# Gather up everything, other than exits and going/garbage, that is under
|
# Gather up everything, other than exits and going/garbage, that is under
|
||||||
# the belief this is its location.
|
# the belief this is its location.
|
||||||
objs = self.obj_location.filter(type__in=[1,2,3])
|
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:
|
for obj in objs:
|
||||||
home = obj.get_home()
|
home = obj.get_home()
|
||||||
|
|
@ -437,13 +443,13 @@ class Object(models.Model):
|
||||||
|
|
||||||
# Obviously, we can't send it back to here.
|
# Obviously, we can't send it back to here.
|
||||||
if home is self:
|
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:
|
if not home:
|
||||||
try:
|
functions_general.log_errmsg("Missing default home, %s '%s(#%d)' now has a null location." % (text, obj.name, obj.id))
|
||||||
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))
|
|
||||||
|
|
||||||
if obj.is_player():
|
if obj.is_player():
|
||||||
if obj.is_connected():
|
if obj.is_connected():
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
# A list of ports to listen on. Can be one or many.
|
# A list of ports to listen on. Can be one or many.
|
||||||
GAMEPORTS = [4000]
|
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,
|
# 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),
|
# email the traceback to the people in the ADMINS tuple below. By default (True),
|
||||||
# show a detailed traceback for the web browser to display.
|
# show a detailed traceback for the web browser to display.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue