Modifies Account.create() to use Character.create() on lesser multisession modes.
This commit is contained in:
parent
3935f42cd8
commit
18bcc4ffa6
1 changed files with 13 additions and 26 deletions
|
|
@ -25,7 +25,7 @@ from evennia.comms.models import ChannelDB
|
||||||
from evennia.commands import cmdhandler
|
from evennia.commands import cmdhandler
|
||||||
from evennia.server.models import ServerConfig
|
from evennia.server.models import ServerConfig
|
||||||
from evennia.server.throttle import Throttle
|
from evennia.server.throttle import Throttle
|
||||||
from evennia.utils import create, logger
|
from evennia.utils import class_from_module, create, logger
|
||||||
from evennia.utils.utils import (lazy_property, to_str,
|
from evennia.utils.utils import (lazy_property, to_str,
|
||||||
make_iter, to_unicode, is_iter,
|
make_iter, to_unicode, is_iter,
|
||||||
variable_from_module)
|
variable_from_module)
|
||||||
|
|
@ -782,33 +782,20 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
|
||||||
errors.append(string)
|
errors.append(string)
|
||||||
logger.log_err(string)
|
logger.log_err(string)
|
||||||
|
|
||||||
if account:
|
if account and settings.MULTISESSION_MODE < 2:
|
||||||
if settings.MULTISESSION_MODE < 2:
|
# Load the appropriate Character class
|
||||||
default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME)
|
Character = class_from_module(settings.BASE_CHARACTER_TYPECLASS)
|
||||||
|
|
||||||
try:
|
# Create the character
|
||||||
character = create.create_object(character_typeclass, key=account.key, home=default_home, permissions=permissions)
|
character, errs = Character.create(account.key, account, ip=ip)
|
||||||
|
errors.extend(errs)
|
||||||
|
|
||||||
# set playable character list
|
if character:
|
||||||
account.db._playable_characters.append(character)
|
# Update playable character list
|
||||||
|
account.db._playable_characters.append(character)
|
||||||
|
|
||||||
# allow only the character itself and the account to puppet this character (and Developers).
|
# We need to set this to have @ic auto-connect to this character
|
||||||
character.locks.add("puppet:id(%i) or pid(%i) or perm(Developer) or pperm(Developer)" %
|
account.db._last_puppet = character
|
||||||
(character.id, account.id))
|
|
||||||
|
|
||||||
# If no description is set, set a default description
|
|
||||||
if not character.db.desc:
|
|
||||||
character.db.desc = "This is a character."
|
|
||||||
# We need to set this to have @ic auto-connect to this character
|
|
||||||
account.db._last_puppet = character
|
|
||||||
|
|
||||||
# Record creator id and creation IP
|
|
||||||
if ip: character.db.creator_ip = ip
|
|
||||||
character.db.creator_id = account.id
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
errors.append("There was an error creating a Character. If this problem persists, contact an admin.")
|
|
||||||
logger.log_trace()
|
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
# We are in the middle between logged in and -not, so we have
|
# We are in the middle between logged in and -not, so we have
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue