PEP8 cleanup of the entire codebase. Unchanged are many cases of too-long lines, partly because of the rewrite they would require but also because splitting many lines up would make the code harder to read. Also the third-party libraries (idmapper, prettytable etc) were not cleaned.
This commit is contained in:
parent
30b7d2a405
commit
1ae17bcbe4
154 changed files with 5613 additions and 4054 deletions
|
|
@ -1,12 +1,13 @@
|
|||
"""
|
||||
Makes it easier to import by grouping all relevant things already at this level.
|
||||
Makes it easier to import by grouping all relevant things already at this
|
||||
level.
|
||||
|
||||
You can henceforth import most things directly from src.player
|
||||
Also, the initiated object manager is available as src.players.manager.
|
||||
|
||||
"""
|
||||
|
||||
from src.players.player import *
|
||||
from src.players.player import *
|
||||
from src.players.models import PlayerDB
|
||||
|
||||
manager = PlayerDB.objects
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
#
|
||||
|
||||
from django import forms
|
||||
from django.db import models
|
||||
#from django.db import models
|
||||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
||||
from django.contrib.admin import widgets
|
||||
#from django.contrib.admin import widgets
|
||||
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
|
||||
from django.contrib.auth.models import User
|
||||
#from django.contrib.auth.models import User
|
||||
from src.players.models import PlayerDB
|
||||
from src.typeclasses.models import Attribute
|
||||
from src.utils import logger, create
|
||||
#from src.typeclasses.models import Attribute
|
||||
from src.utils import create
|
||||
|
||||
|
||||
# handle the custom User editor
|
||||
|
|
@ -109,6 +109,7 @@ class PlayerForm(forms.ModelForm):
|
|||
required=False,
|
||||
help_text="python path to player cmdset class (set in settings.CMDSET_PLAYER by default)")
|
||||
|
||||
|
||||
class PlayerInline(admin.StackedInline):
|
||||
"Inline creation of Player"
|
||||
model = PlayerDB
|
||||
|
|
@ -127,6 +128,7 @@ class PlayerInline(admin.StackedInline):
|
|||
extra = 1
|
||||
max_num = 1
|
||||
|
||||
|
||||
class PlayerDBAdmin(BaseUserAdmin):
|
||||
"This is the main creation screen for Users/players"
|
||||
|
||||
|
|
@ -136,17 +138,17 @@ class PlayerDBAdmin(BaseUserAdmin):
|
|||
fieldsets = (
|
||||
(None, {'fields': ('username', 'password', 'email')}),
|
||||
('Website profile', {'fields': ('first_name', 'last_name'),
|
||||
'description':"<i>These are not used in the default system.</i>"}),
|
||||
'description': "<i>These are not used in the default system.</i>"}),
|
||||
('Website dates', {'fields': ('last_login', 'date_joined'),
|
||||
'description':'<i>Relevant only to the website.</i>'}),
|
||||
('Website Permissions', {'fields': ('is_active', 'is_staff', 'is_superuser', 'user_permissions','groups'),
|
||||
'description': '<i>Relevant only to the website.</i>'}),
|
||||
('Website Permissions', {'fields': ('is_active', 'is_staff', 'is_superuser',
|
||||
'user_permissions', 'groups'),
|
||||
'description': "<i>These are permissions/permission groups for accessing the admin site. They are unrelated to in-game access rights.</i>"}),
|
||||
('Game Options', {'fields': ('db_typeclass_path', 'db_cmdset_storage', 'db_lock_storage'),
|
||||
'description': '<i>These are attributes that are more relevant to gameplay.</i>'}))
|
||||
#('Game Options', {'fields': ('db_typeclass_path', 'db_cmdset_storage', 'db_permissions', 'db_lock_storage'),
|
||||
# 'description': '<i>These are attributes that are more relevant to gameplay.</i>'}))
|
||||
|
||||
|
||||
add_fieldsets = (
|
||||
(None,
|
||||
{'fields': ('username', 'password1', 'password2', 'email'),
|
||||
|
|
@ -162,7 +164,7 @@ class PlayerDBAdmin(BaseUserAdmin):
|
|||
#uname, passwd, email = str(request.POST.get(u"username")), \
|
||||
# str(request.POST.get(u"password1")), str(request.POST.get(u"email"))
|
||||
typeclass = str(request.POST.get(u"playerdb_set-0-db_typeclass_path"))
|
||||
create.create_player("","","",
|
||||
create.create_player("", "", "",
|
||||
user=userobj,
|
||||
typeclass=typeclass,
|
||||
player_dbobj=userobj)
|
||||
|
|
|
|||
|
|
@ -4,11 +4,12 @@ The managers for the custom Player object and permissions.
|
|||
|
||||
import datetime
|
||||
from django.contrib.auth.models import UserManager
|
||||
from functools import update_wrapper
|
||||
#from functools import update_wrapper
|
||||
from src.typeclasses.managers import returns_typeclass_list, returns_typeclass, TypedObjectManager
|
||||
from src.utils import logger
|
||||
#from src.utils import logger
|
||||
__all__ = ("PlayerManager",)
|
||||
|
||||
|
||||
#
|
||||
# Player Manager
|
||||
#
|
||||
|
|
@ -118,8 +119,8 @@ class PlayerManager(TypedObjectManager, UserManager):
|
|||
|
||||
def swap_character(self, player, new_character, delete_old_character=False):
|
||||
"""
|
||||
This disconnects a player from the current character (if any) and connects
|
||||
to a new character object.
|
||||
This disconnects a player from the current character (if any) and
|
||||
connects to a new character object.
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -23,15 +23,16 @@ from django.utils.encoding import smart_str
|
|||
|
||||
from src.players import manager
|
||||
from src.scripts.models import ScriptDB
|
||||
from src.typeclasses.models import TypedObject, TagHandler, NickHandler, AliasHandler, AttributeHandler
|
||||
from src.typeclasses.models import (TypedObject, TagHandler, NickHandler,
|
||||
AliasHandler, AttributeHandler)
|
||||
from src.commands.cmdsethandler import CmdSetHandler
|
||||
from src.commands import cmdhandler
|
||||
from src.utils import utils
|
||||
from src.utils import utils, logger
|
||||
from src.utils.utils import to_str, make_iter
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
__all__ = ("PlayerDB",)
|
||||
__all__ = ("PlayerDB",)
|
||||
|
||||
_ME = _("me")
|
||||
_SELF = _("self")
|
||||
|
|
@ -47,14 +48,12 @@ _DA = object.__delattr__
|
|||
_TYPECLASS = None
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
#
|
||||
# PlayerDB
|
||||
#
|
||||
#------------------------------------------------------------
|
||||
|
||||
|
||||
class PlayerDB(TypedObject, AbstractUser):
|
||||
"""
|
||||
This is a special model using Django's 'profile' functionality
|
||||
|
|
@ -90,7 +89,9 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
|
||||
# store a connected flag here too, not just in sessionhandler.
|
||||
# This makes it easier to track from various out-of-process locations
|
||||
db_is_connected = models.BooleanField(default=False, verbose_name="is_connected", help_text="If player is connected to game or not")
|
||||
db_is_connected = models.BooleanField(default=False,
|
||||
verbose_name="is_connected",
|
||||
help_text="If player is connected to game or not")
|
||||
# database storage of persistant cmdsets.
|
||||
db_cmdset_storage = models.CharField('cmdset', max_length=255, null=True,
|
||||
help_text="optional python path to a cmdset class. If creating a Character, this will default to settings.CMDSET_CHARACTER.")
|
||||
|
|
@ -118,24 +119,36 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
_SA(self, "nicks", NickHandler(self))
|
||||
|
||||
# alias to the objs property
|
||||
def __characters_get(self): return self.objs
|
||||
def __characters_set(self, value): self.objs = value
|
||||
def __characters_del(self): raise Exception("Cannot delete name")
|
||||
def __characters_get(self):
|
||||
return self.objs
|
||||
|
||||
def __characters_set(self, value):
|
||||
self.objs = value
|
||||
|
||||
def __characters_del(self):
|
||||
raise Exception("Cannot delete name")
|
||||
characters = property(__characters_get, __characters_set, __characters_del)
|
||||
|
||||
# cmdset_storage property
|
||||
# This seems very sensitive to caching, so leaving it be for now /Griatch
|
||||
#@property
|
||||
def cmdset_storage_get(self):
|
||||
"Getter. Allows for value = self.name. Returns a list of cmdset_storage."
|
||||
"""
|
||||
Getter. Allows for value = self.name. Returns a list of cmdset_storage.
|
||||
"""
|
||||
storage = _GA(self, "db_cmdset_storage")
|
||||
# we need to check so storage is not None
|
||||
return [path.strip() for path in storage.split(',')] if storage else []
|
||||
return [path.strip() for path in storage.split(',')] if storage else []
|
||||
|
||||
#@cmdset_storage.setter
|
||||
def cmdset_storage_set(self, value):
|
||||
"Setter. Allows for self.name = value. Stores as a comma-separated string."
|
||||
"""
|
||||
Setter. Allows for self.name = value. Stores as a comma-separated
|
||||
string.
|
||||
"""
|
||||
_SA(self, "db_cmdset_storage", ",".join(str(val).strip() for val in make_iter(value)))
|
||||
_GA(self, "save")()
|
||||
|
||||
#@cmdset_storage.deleter
|
||||
def cmdset_storage_del(self):
|
||||
"Deleter. Allows for del self.name"
|
||||
|
|
@ -161,10 +174,12 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
#@property
|
||||
def __username_get(self):
|
||||
return _GA(self, "username")
|
||||
|
||||
def __username_set(self, value):
|
||||
_SA(self, "username", value)
|
||||
|
||||
def __username_del(self):
|
||||
_DA(self, "username", value)
|
||||
_DA(self, "username")
|
||||
# aliases
|
||||
name = property(__username_get, __username_set, __username_del)
|
||||
key = property(__username_get, __username_set, __username_del)
|
||||
|
|
@ -173,8 +188,10 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
def __uid_get(self):
|
||||
"Getter. Retrieves the user id"
|
||||
return self.id
|
||||
|
||||
def __uid_set(self, value):
|
||||
raise Exception("User id cannot be set!")
|
||||
|
||||
def __uid_del(self):
|
||||
raise Exception("User id cannot be deleted!")
|
||||
uid = property(__uid_get, __uid_set, __uid_del)
|
||||
|
|
@ -197,21 +214,21 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
def msg(self, text=None, from_obj=None, sessid=None, **kwargs):
|
||||
"""
|
||||
Evennia -> User
|
||||
This is the main route for sending data back to the user from the server.
|
||||
This is the main route for sending data back to the user from the
|
||||
server.
|
||||
|
||||
outgoing_string (string) - text data to send
|
||||
from_obj (Object/Player) - source object of message to send. Its at_msg_send
|
||||
hook will be called.
|
||||
sessid - the session id of the session to send to. If not given, return to
|
||||
all sessions connected to this player. This is usually only
|
||||
from_obj (Object/Player) - source object of message to send. Its
|
||||
at_msg_send() hook will be called.
|
||||
sessid - the session id of the session to send to. If not given, return
|
||||
to all sessions connected to this player. This is usually only
|
||||
relevant when using msg() directly from a player-command (from
|
||||
a command on a Character, the character automatically stores and
|
||||
handles the sessid).
|
||||
a command on a Character, the character automatically stores
|
||||
and handles the sessid).
|
||||
kwargs (dict) - All other keywords are parsed as extra data.
|
||||
"""
|
||||
if "data" in kwargs:
|
||||
# deprecation warning
|
||||
from src.utils import logger
|
||||
logger.log_depmsg("PlayerDB:msg() 'data'-dict keyword is deprecated. Use **kwargs instead.")
|
||||
data = kwargs.pop("data")
|
||||
if isinstance(data, dict):
|
||||
|
|
@ -253,16 +270,17 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
if not _SESSIONS:
|
||||
from src.server.sessionhandler import SESSIONS as _SESSIONS
|
||||
return _SESSIONS.sessions_from_player(self)
|
||||
sessions = property(get_all_sessions) # alias shortcut
|
||||
|
||||
sessions = property(get_all_sessions) # alias shortcut
|
||||
|
||||
def disconnect_session_from_player(self, sessid):
|
||||
"""
|
||||
Access method for disconnecting a given session from the player
|
||||
(connection happens automatically in the sessionhandler)
|
||||
"""
|
||||
# this should only be one value, loop just to make sure to clean everything
|
||||
sessions = (session for session in self.get_all_sessions() if session.sessid == sessid)
|
||||
# this should only be one value, loop just to make sure to
|
||||
# clean everything
|
||||
sessions = (session for session in self.get_all_sessions()
|
||||
if session.sessid == sessid)
|
||||
for session in sessions:
|
||||
# this will also trigger unpuppeting
|
||||
session.sessionhandler.disconnect(session)
|
||||
|
|
@ -292,8 +310,9 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
# we don't allow to puppet an object already controlled by an active
|
||||
# player. To kick a player, call unpuppet_object on them explicitly.
|
||||
return
|
||||
# if we get to this point the character is ready to puppet or it was left
|
||||
# with a lingering player/sessid reference from an unclean server kill or similar
|
||||
# if we get to this point the character is ready to puppet or it
|
||||
# was left with a lingering player/sessid reference from an unclean
|
||||
# server kill or similar
|
||||
|
||||
if normal_mode:
|
||||
_GA(obj.typeclass, "at_pre_puppet")(self.typeclass, sessid=sessid)
|
||||
|
|
@ -341,8 +360,9 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
|
||||
def get_puppet(self, sessid, return_dbobj=False):
|
||||
"""
|
||||
Get an object puppeted by this session through this player. This is the main
|
||||
method for retrieving the puppeted object from the player's end.
|
||||
Get an object puppeted by this session through this player. This is
|
||||
the main method for retrieving the puppeted object from the
|
||||
player's end.
|
||||
|
||||
sessid - return character connected to this sessid,
|
||||
character - return character if connected to this player, else None.
|
||||
|
|
@ -359,7 +379,8 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
"""
|
||||
Get all currently puppeted objects as a list
|
||||
"""
|
||||
puppets = [session.puppet for session in self.get_all_sessions() if session.puppet]
|
||||
puppets = [session.puppet for session in self.get_all_sessions()
|
||||
if session.puppet]
|
||||
if return_dbobj:
|
||||
return puppets
|
||||
return [puppet.typeclass for puppet in puppets]
|
||||
|
|
@ -379,30 +400,25 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
|
||||
# utility methods
|
||||
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
"""
|
||||
Deletes the player permanently.
|
||||
Makes sure to delete user also when deleting player - the two may never exist separately.
|
||||
"""
|
||||
for session in self.get_all_sessions():
|
||||
# unpuppeting all objects and disconnecting the user, if any
|
||||
# sessions remain (should usually be handled from the deleting command)
|
||||
# sessions remain (should usually be handled from the
|
||||
# deleting command)
|
||||
self.unpuppet_object(session.sessid)
|
||||
session.sessionhandler.disconnect(session, reason=_("Player being deleted."))
|
||||
|
||||
#try:
|
||||
# if _GA(self, "user"):
|
||||
# _GA(_GA(self, "user"), "delete")()
|
||||
#except AssertionError:
|
||||
# pass
|
||||
super(PlayerDB, self).delete(*args, **kwargs)
|
||||
|
||||
def execute_cmd(self, raw_string, sessid=None):
|
||||
"""
|
||||
Do something as this player. This method is never called normally,
|
||||
but only when the player object itself is supposed to execute the command. It
|
||||
does not take nicks on eventual puppets into account.
|
||||
but only when the player object itself is supposed to execute the
|
||||
command. It does not take nicks on eventual puppets into account.
|
||||
|
||||
raw_string - raw command input coming from the command line.
|
||||
"""
|
||||
# nick replacement - we require full-word matching.
|
||||
|
|
@ -410,8 +426,9 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
raw_string = utils.to_unicode(raw_string)
|
||||
|
||||
raw_list = raw_string.split(None)
|
||||
raw_list = [" ".join(raw_list[:i+1]) for i in range(len(raw_list)) if raw_list[:i+1]]
|
||||
# get the nick replacement data directly from the database to be able to use db_category__in
|
||||
raw_list = [" ".join(raw_list[:i + 1]) for i in range(len(raw_list)) if raw_list[:i + 1]]
|
||||
# get the nick replacement data directly from the database to be
|
||||
# able to use db_category__in
|
||||
nicks = self.db_attributes.filter(db_category__in=("nick_inputline", "nick_channel"))
|
||||
for nick in nicks:
|
||||
if nick.db_key in raw_list:
|
||||
|
|
@ -419,22 +436,30 @@ class PlayerDB(TypedObject, AbstractUser):
|
|||
break
|
||||
if not sessid and _MULTISESSION_MODE in (0, 1):
|
||||
# in this case, we should either have only one sessid, or the sessid
|
||||
# should not matter (since the return goes to all of them we can just
|
||||
# use the first one as the source)
|
||||
# should not matter (since the return goes to all of them we can
|
||||
# just use the first one as the source)
|
||||
sessid = self.get_all_sessions()[0].sessid
|
||||
return cmdhandler.cmdhandler(self.typeclass, raw_string, callertype="player", sessid=sessid)
|
||||
return cmdhandler.cmdhandler(self.typeclass, raw_string,
|
||||
callertype="player", sessid=sessid)
|
||||
|
||||
def search(self, ostring, return_character=False, **kwargs):
|
||||
def search(self, ostring, return_puppet=False,
|
||||
return_character=False, **kwargs):
|
||||
"""
|
||||
This is similar to the ObjectDB search method but will search for Players only. Errors
|
||||
will be echoed, and None returned if no Player is found.
|
||||
This is similar to the ObjectDB search method but will search for
|
||||
Players only. Errors will be echoed, and None returned if no Player
|
||||
is found.
|
||||
|
||||
return_character - will try to return the character the player controls instead of
|
||||
the Player object itself. If no Character exists (since Player is
|
||||
OOC), None will be returned.
|
||||
Extra keywords are ignored, but are allowed in call in order to make API more consistent
|
||||
with objects.models.TypedObject.search.
|
||||
return_character - will try to return the character the player controls
|
||||
instead of the Player object itself. If no
|
||||
Character exists (since Player is OOC), None will
|
||||
be returned.
|
||||
Extra keywords are ignored, but are allowed in call in order to make
|
||||
API more consistent with objects.models.
|
||||
TypedObject.search.
|
||||
"""
|
||||
if return_character:
|
||||
logger.log_depmsg("Player.search's 'return_character' keyword is deprecated. Use the return_puppet keyword instead.")
|
||||
#return_puppet = return_character
|
||||
# handle me, self
|
||||
if ostring in (_ME, _SELF, '*' + _ME, '*' + _SELF):
|
||||
return self
|
||||
|
|
|
|||
|
|
@ -41,23 +41,29 @@ class Player(TypeClass):
|
|||
|
||||
key (string) - name of player
|
||||
name (string)- wrapper for user.username
|
||||
aliases (list of strings) - aliases to the object. Will be saved to database as AliasDB entries but returned as strings.
|
||||
aliases (list of strings) - aliases to the object. Will be saved to
|
||||
database as AliasDB entries but returned as strings.
|
||||
dbref (int, read-only) - unique #id-number. Also "id" can be used.
|
||||
dbobj (Player, read-only) - link to database model. dbobj.typeclass points back to this class
|
||||
typeclass (Player, read-only) - this links back to this class as an identified only. Use self.swap_typeclass() to switch.
|
||||
dbobj (Player, read-only) - link to database model. dbobj.typeclass
|
||||
points back to this class
|
||||
typeclass (Player, read-only) - this links back to this class as an
|
||||
identified only. Use self.swap_typeclass() to switch.
|
||||
date_created (string) - time stamp of object creation
|
||||
permissions (list of strings) - list of permission strings
|
||||
|
||||
user (User, read-only) - django User authorization object
|
||||
obj (Object) - game object controlled by player. 'character' can also be used.
|
||||
obj (Object) - game object controlled by player. 'character' can also
|
||||
be used.
|
||||
sessions (list of Sessions) - sessions connected to this player
|
||||
is_superuser (bool, read-only) - if the connected user is a superuser
|
||||
|
||||
* Handlers
|
||||
|
||||
locks - lock-handler: use locks.add() to add new lock strings
|
||||
db - attribute-handler: store/retrieve database attributes on this self.db.myattr=val, val=self.db.myattr
|
||||
ndb - non-persistent attribute handler: same as db but does not create a database entry when storing data
|
||||
db - attribute-handler: store/retrieve database attributes on this
|
||||
self.db.myattr=val, val=self.db.myattr
|
||||
ndb - non-persistent attribute handler: same as db but does not
|
||||
create a database entry when storing data
|
||||
scripts - script-handler. Add new scripts to object with scripts.add()
|
||||
cmdset - cmdset-handler. Use cmdset.add() to add new cmdsets to object
|
||||
nicks - nick-handler. New nicks with nicks.add().
|
||||
|
|
@ -67,7 +73,9 @@ class Player(TypeClass):
|
|||
msg(outgoing_string, from_obj=None, **kwargs)
|
||||
swap_character(new_character, delete_old_character=False)
|
||||
execute_cmd(raw_string)
|
||||
search(ostring, global_search=False, attribute_name=None, use_nicks=False, location=None, ignore_errors=False, player=False)
|
||||
search(ostring, global_search=False, attribute_name=None,
|
||||
use_nicks=False, location=None,
|
||||
ignore_errors=False, player=False)
|
||||
is_typeclass(typeclass, exact=False)
|
||||
swap_typeclass(new_typeclass, clean_attributes=False, no_default=True)
|
||||
access(accessing_obj, access_type='read', default=False)
|
||||
|
|
@ -99,15 +107,16 @@ class Player(TypeClass):
|
|||
def msg(self, text=None, from_obj=None, sessid=None, **kwargs):
|
||||
"""
|
||||
Evennia -> User
|
||||
This is the main route for sending data back to the user from the server.
|
||||
This is the main route for sending data back to the user from
|
||||
the server.
|
||||
|
||||
text (string) - text data to send
|
||||
from_obj (Object/Player) - source object of message to send
|
||||
sessid - the session id of the session to send to. If not given, return to
|
||||
all sessions connected to this player. This is usually only
|
||||
relevant when using msg() directly from a player-command (from
|
||||
a command on a Character, the character automatically stores and
|
||||
handles the sessid).
|
||||
sessid - the session id of the session to send to. If not given,
|
||||
return to all sessions connected to this player. This is usually only
|
||||
relevant when using msg() directly from a player-command (from
|
||||
a command on a Character, the character automatically stores and
|
||||
handles the sessid).
|
||||
kwargs - extra data to send through protocol
|
||||
"""
|
||||
self.dbobj.msg(text=text, from_obj=from_obj, sessid=sessid, **kwargs)
|
||||
|
|
@ -131,16 +140,18 @@ class Player(TypeClass):
|
|||
|
||||
Argument:
|
||||
raw_string (string) - raw command input
|
||||
sessid (int) - id of session executing the command. This sets the sessid property on the command
|
||||
sessid (int) - id of session executing the command. This sets the
|
||||
sessid property on the command
|
||||
|
||||
Returns Deferred - this is an asynchronous Twisted object that will
|
||||
not fire until the command has actually finished executing. To overload
|
||||
this one needs to attach callback functions to it, with addCallback(function).
|
||||
This function will be called with an eventual return value from the command
|
||||
execution.
|
||||
not fire until the command has actually finished executing. To
|
||||
overload this one needs to attach callback functions to it, with
|
||||
addCallback(function). This function will be called with an
|
||||
eventual return value from the command execution.
|
||||
|
||||
This return is not used at all by Evennia by default, but might be useful
|
||||
for coders intending to implement some sort of nested command structure.
|
||||
This return is not used at all by Evennia by default, but might
|
||||
be useful for coders intending to implement some sort of nested
|
||||
command structure.
|
||||
"""
|
||||
return self.dbobj.execute_cmd(raw_string, sessid=sessid)
|
||||
|
||||
|
|
@ -204,11 +215,13 @@ class Player(TypeClass):
|
|||
|
||||
|
||||
"""
|
||||
self.dbobj.swap_typeclass(new_typeclass, clean_attributes=clean_attributes, no_default=no_default)
|
||||
self.dbobj.swap_typeclass(new_typeclass,
|
||||
clean_attributes=clean_attributes, no_default=no_default)
|
||||
|
||||
def access(self, accessing_obj, access_type='read', default=False):
|
||||
"""
|
||||
Determines if another object has permission to access this object in whatever way.
|
||||
Determines if another object has permission to access this object
|
||||
in whatever way.
|
||||
|
||||
accessing_obj (Object)- object trying to access this one
|
||||
access_type (string) - type of access sought
|
||||
|
|
@ -221,8 +234,8 @@ class Player(TypeClass):
|
|||
This explicitly checks the given string against this object's
|
||||
'permissions' property without involving any locks.
|
||||
|
||||
permstring (string) - permission string that need to match a permission on the object.
|
||||
(example: 'Builders')
|
||||
permstring (string) - permission string that need to match a permission
|
||||
on the object. (example: 'Builders')
|
||||
"""
|
||||
return self.dbobj.check_permstring(permstring)
|
||||
|
||||
|
|
@ -307,7 +320,8 @@ class Player(TypeClass):
|
|||
except Exception:
|
||||
logger.log_trace()
|
||||
now = datetime.datetime.now()
|
||||
now = "%02i-%02i-%02i(%02i:%02i)" % (now.year, now.month, now.day, now.hour, now.minute)
|
||||
now = "%02i-%02i-%02i(%02i:%02i)" % (now.year, now.month,
|
||||
now.day, now.hour, now.minute)
|
||||
if _CONNECT_CHANNEL:
|
||||
_CONNECT_CHANNEL.tempmsg("[%s, %s]: %s" % (_CONNECT_CHANNEL.key, now, message))
|
||||
else:
|
||||
|
|
@ -361,15 +375,15 @@ class Player(TypeClass):
|
|||
|
||||
def at_server_reload(self):
|
||||
"""
|
||||
This hook is called whenever the server is shutting down for restart/reboot.
|
||||
If you want to, for example, save non-persistent properties across a restart,
|
||||
this is the place to do it.
|
||||
This hook is called whenever the server is shutting down for
|
||||
restart/reboot. If you want to, for example, save non-persistent
|
||||
properties across a restart, this is the place to do it.
|
||||
"""
|
||||
pass
|
||||
|
||||
def at_server_shutdown(self):
|
||||
"""
|
||||
This hook is called whenever the server is shutting down fully (i.e. not for
|
||||
a restart).
|
||||
This hook is called whenever the server is shutting down fully
|
||||
(i.e. not for a restart).
|
||||
"""
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue