Fixed a very silly bug in CmdUnloggedinCreate where the default location was set on the character even though the Player hadn't actually logged in yet. This meant that the Character (in MULTISESSION_MODEs < 2) would pop up in the start location and stay there also if the Player never actually connected to the game. This is most likely the reason for zombie player remnants that have been around for so long and should thus have an impact also on #498.

This commit is contained in:
Griatch 2015-03-07 22:55:01 +01:00
parent 686bc92888
commit 7f20631bfc
4 changed files with 23 additions and 21 deletions

View file

@ -129,11 +129,10 @@ class CmdUnconnectedConnect(MuxCommand):
permissions = settings.PERMISSION_GUEST_DEFAULT
typeclass = settings.BASE_CHARACTER_TYPECLASS
ptypeclass = settings.BASE_GUEST_TYPECLASS
start_location = ObjectDB.objects.get_id(settings.GUEST_START_LOCATION)
new_player = _create_player(session, playername, password,
home, permissions, ptypeclass)
if new_player:
_create_character(session, new_player, typeclass, start_location,
_create_character(session, new_player, typeclass,
home, permissions)
session.sessionhandler.login(session, new_player)
@ -265,14 +264,13 @@ class CmdUnconnectedCreate(MuxCommand):
# everything's ok. Create the new player account.
try:
default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME)
permissions = settings.PERMISSION_PLAYER_DEFAULT
typeclass = settings.BASE_CHARACTER_TYPECLASS
new_player = _create_player(session, playername, password, default_home, permissions)
start_location = ObjectDB.objects.get_id(settings.START_LOCATION)
new_player = _create_player(session, playername, password, permissions)
if new_player:
if MULTISESSION_MODE < 2:
_create_character(session, new_player, typeclass, start_location,
default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME)
_create_character(session, new_player, typeclass,
default_home, permissions)
# tell the caller everything went well.
string = "A new account '%s' was created. Welcome!"
@ -438,8 +436,7 @@ class CmdUnconnectedEncoding(MuxCommand):
self.caller.msg(string.strip())
def _create_player(session, playername, password,
default_home, permissions, typeclass=None):
def _create_player(session, playername, password, permissions, typeclass=None):
"""
Helper function, creates a player of the specified typeclass.
"""
@ -465,17 +462,14 @@ def _create_player(session, playername, password,
return new_player
def _create_character(session, new_player, typeclass, start_location, home, permissions):
def _create_character(session, new_player, typeclass, home, permissions):
"""
Helper function, creates a character based on a player's name.
This is meant for Guest and MULTISESSION_MODE < 2 situations.
"""
try:
if not start_location:
start_location = home # fallback
new_character = create.create_object(typeclass, key=new_player.key,
location=start_location, home=home,
permissions=permissions)
home=home, permissions=permissions)
# set playable character list
new_player.db._playable_characters.append(new_character)

View file

@ -26,7 +26,7 @@ from evennia.scripts.scripthandler import ScriptHandler
from evennia.commands import cmdset, command
from evennia.commands.cmdsethandler import CmdSetHandler
from evennia.commands import cmdhandler
from evennia.utils.logger import log_depmsg, log_trace, log_errmsg
from evennia.utils.logger import log_trace, log_errmsg
from evennia.utils.utils import (variable_from_module, lazy_property,
make_iter, to_str, to_unicode)

View file

@ -143,6 +143,11 @@ def c_examines(client):
cmds = "examine me"
return cmds
def c_idles(client):
"idles"
cmds = ('idle','idle')
return cmds
def c_help(client):
"reads help files"
cmds = ('help',
@ -239,13 +244,17 @@ def c_moves_s(client):
# #(0.1, c_creates_obj),
# #(0.1, c_creates_button),
# #(0.4, c_moves))
# "inactive player" definition
ACTIONS = (c_login_nodig,
c_logout,
(1.0, c_idles))
## "normal player" definition
ACTIONS = ( c_login,
c_logout,
(0.01, c_digs),
(0.39, c_looks),
(0.2, c_help),
(0.4, c_moves))
#ACTIONS = ( c_login,
# c_logout,
# (0.01, c_digs),
# (0.39, c_looks),
# (0.2, c_help),
# (0.4, c_moves))
# walking tester. This requires a pre-made
# "loop" of multiple rooms that ties back
# to limbo (using @tunnel and @open)

View file

@ -17,7 +17,6 @@ from django.conf import settings
from evennia.commands.cmdhandler import CMD_LOGINSTART
from evennia.utils.utils import variable_from_module, is_iter, \
to_str, to_unicode, strip_control_sequences, make_iter
from evennia.utils import logger
try:
import cPickle as pickle