Removed CHARACTER_DEFAULT_HOME, replaced with DEFAULT_HOME and added START_LOCATION for determining where default commands dump new characters.

This commit is contained in:
Griatch 2014-04-20 15:56:38 +02:00
parent 7d0ff9c71c
commit 91b23f58a4
8 changed files with 41 additions and 27 deletions

View file

@ -525,14 +525,15 @@ class CmdDestroy(MuxCommand):
if not obj:
self.caller.msg(" (Objects to destroy must either be local or specified with a unique #dbref.)")
return ""
if (not "override" in self.switches and
obj.dbid == int(settings.CHARACTER_DEFAULT_HOME.lstrip("#"))):
return "\nYou are trying to delete CHARACTER_DEFAULT_HOME. If you want to do this, use the /override switch."
objname = obj.name
if not obj.access(caller, 'delete'):
return "\nYou don't have permission to delete %s." % objname
if obj.player and not 'override' in self.switches:
return "\nObject %s is controlled by an active player. Use /override to delete anyway." % objname
if obj.dbid == int(settings.DEFAULT_HOME.lstrip("#")):
return "\nYou are trying to delete {c%s{n, which is set as DEFAULT_HOME. " \
"Re-point settings.DEFAULT_HOME to another " \
"object before continuing." % objname
had_exits = hasattr(obj, "exits") and obj.exits
had_objs = hasattr(obj, "contents") and any(obj for obj in obj.contents

View file

@ -181,12 +181,13 @@ class CmdCharCreate(MuxPlayerCommand):
# create the character
from src.objects.models import ObjectDB
default_home = ObjectDB.objects.get_id(settings.CHARACTER_DEFAULT_HOME)
start_location = ObjectDB.objects.get_id(settings.START_LOCATION)
default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME)
typeclass = settings.BASE_CHARACTER_TYPECLASS
permissions = settings.PERMISSION_PLAYER_DEFAULT
new_character = create.create_object(typeclass, key=key,
location=default_home,
location=start_location,
home=default_home,
permissions=permissions)
# only allow creator (and immortals) to puppet this char

View file

@ -160,7 +160,7 @@ class CmdUnconnectedCreate(MuxCommand):
# everything's ok. Create the new player account.
try:
default_home = ObjectDB.objects.get_id(settings.CHARACTER_DEFAULT_HOME)
default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME)
typeclass = settings.BASE_CHARACTER_TYPECLASS
permissions = settings.PERMISSION_PLAYER_DEFAULT
@ -190,8 +190,9 @@ class CmdUnconnectedCreate(MuxCommand):
if MULTISESSION_MODE < 2:
# if we only allow one character, create one with the same name as Player
# (in mode 2, the character must be created manually once logging in)
start_location = settings.START_LOCATION
new_character = create.create_object(typeclass, key=playername,
location=default_home, home=default_home,
location=start_location, home=default_home,
permissions=permissions)
# set playable character list
new_player.db._playable_characters.append(new_character)