Some cleanup and changing to conform to PEP8 standard.

This commit is contained in:
Griatch 2014-07-10 20:29:16 +02:00
parent 364b156456
commit 3819c97b06
3 changed files with 32 additions and 32 deletions

View file

@ -81,10 +81,10 @@ class CmdUnconnectedConnect(MuxCommand):
ptypeclass = settings.BASE_GUEST_TYPECLASS
start_location = ObjectDB.objects.get_id(settings.GUEST_START_LOCATION)
new_player = CreatePlayer(session, playername, password,
new_player = _create_player(session, playername, password,
home, permissions, ptypeclass)
if new_player:
CreateCharacter(session, new_player, typeclass, start_location,
_create_character(session, new_player, typeclass, start_location,
home, permissions)
session.sessionhandler.login(session, new_player)
@ -217,11 +217,11 @@ class CmdUnconnectedCreate(MuxCommand):
default_home = ObjectDB.objects.get_id(settings.DEFAULT_HOME)
permissions = settings.PERMISSION_PLAYER_DEFAULT
typeclass = settings.BASE_CHARACTER_TYPECLASS
new_player = CreatePlayer(session, playername, password, default_home, permissions)
new_player = _create_player(session, playername, password, default_home, permissions)
start_location = ObjectDB.objects.get_id(settings.START_LOCATION)
if new_player:
if MULTISESSION_MODE < 2:
CreateCharacter(session, new_player, typeclass, start_location,
_create_character(session, new_player, typeclass, start_location,
default_home, permissions)
# tell the caller everything went well.
string = "A new account '%s' was created. Welcome!"
@ -334,10 +334,10 @@ You can use the {wlook{n command if you want to see the connect screen again.
self.caller.msg(string)
def CreatePlayer(session, playername, password,
def _create_player(session, playername, password,
default_home, permissions, typeclass=None):
"""
Creates a player of the specified typeclass.
Helper function, creates a player of the specified typeclass.
"""
try:
new_player = create.create_player(playername, None, password,
@ -363,10 +363,10 @@ def CreatePlayer(session, playername, password,
return new_player
def CreateCharacter(session, new_player, typeclass, start_location, home, permissions):
def _create_character(session, new_player, typeclass, start_location, home, permissions):
"""
Creates a character based on a player's name. This is meant for Guest and
MULTISESSION_MODE <2 situations.
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:

View file

@ -306,14 +306,14 @@ BASE_SCRIPT_TYPECLASS = "src.scripts.scripts.DoNothing"
# fallback if an object's normal home location is deleted. Default
# is Limbo (#2).
DEFAULT_HOME = "#2"
# This enables guest logins.
GUEST_ENABLED = True
# The default home location used for guests.
GUEST_HOME = "#2"
# The start position for new characters. Default is Limbo (#2).
# MULTISESSION_MODE = 0, 1 - used by default unloggedin create command
# MULTISESSION_MODE = 2 - used by default character_create command
START_LOCATION = "#2"
# This enables guest logins.
GUEST_ENABLED = True
# The default home location used for guests.
GUEST_HOME = "#2"
# The start position used for guest characters.
GUEST_START_LOCATION = "#2"
# The naming convention for guest players/characters. The size of this list