Added a check for multiple connected sessions to avoid moving disconnected object more than once. Resolves issue 145.

This commit is contained in:
Griatch 2011-03-19 22:17:00 +00:00
parent 8288534cf6
commit 2f78bacd97
6 changed files with 26 additions and 19 deletions

View file

@ -113,9 +113,10 @@ class Character(BaseCharacter):
We stove away the character when logging off, otherwise they will remain where We stove away the character when logging off, otherwise they will remain where
they are, 'headless', so to say. they are, 'headless', so to say.
""" """
self.location.msg_contents("%s has left the game." % self.name) if self.location: # have to check, in case of multiple connections
self.db.prelogout_location = self.location self.location.msg_contents("%s has left the game." % self.name)
self.location = None self.db.prelogout_location = self.location
self.location = None
def at_post_login(self): def at_post_login(self):
""" """

View file

@ -330,8 +330,7 @@ class CmdQuit(MuxCommand):
def func(self): def func(self):
"hook function" "hook function"
sessions = self.caller.sessions for session in self.caller.sessions:
for session in sessions:
session.msg("Quitting. Hope to see you soon again.") session.msg("Quitting. Hope to see you soon again.")
session.session_disconnect() session.session_disconnect()

View file

@ -55,7 +55,7 @@ class Object(TypeClass):
if create_cmdset: if create_cmdset:
dbobj.cmdset = CmdSetHandler(dbobj) dbobj.cmdset = CmdSetHandler(dbobj)
if utils.inherits_from(self, settings.BASE_CHARACTER_TYPECLASS): if utils.inherits_from(self, settings.BASE_CHARACTER_TYPECLASS) or utils.inherits_from(self, Character):
dbobj.cmdset.outside_access = False dbobj.cmdset.outside_access = False
if create_scripts: if create_scripts:
dbobj.scripts = ScriptHandler(dbobj) dbobj.scripts = ScriptHandler(dbobj)

View file

@ -15,9 +15,13 @@ from django.conf import settings
# To ensure the sanity of the model, there are a # To ensure the sanity of the model, there are a
# few property names we won't allow the admin to # few property names we won't allow the admin to
# set just like that. # set just like that. Note that these are *not* related
# to *in-game* safety (if you can edit typeclasses you have
# full access anyway), so no protection against changing
# e.g. 'locks' or 'permissions' should go here.
PROTECTED = ['id', 'dbobj', 'db', 'objects', 'typeclass', PROTECTED = ['id', 'dbobj', 'db', 'objects', 'typeclass',
'attr', 'save', 'delete'] 'attr', 'save', 'delete']
# If this is true, all non-protected property assignments # If this is true, all non-protected property assignments
# are directly stored to a database attribute # are directly stored to a database attribute
try: try:

View file

@ -16,17 +16,20 @@ def log_trace(errmsg=None):
adds an extra line with added info. adds an extra line with added info.
""" """
tracestring = format_exc() tracestring = format_exc()
if tracestring: try:
for line in tracestring.splitlines(): if tracestring:
log.msg('[::] %s' % line) for line in tracestring.splitlines():
if errmsg: log.msg('[::] %s' % line)
try: if errmsg:
errmsg = utils.to_str(errmsg) try:
except Exception, e: errmsg = utils.to_str(errmsg)
errmsg = str(e) except Exception, e:
for line in errmsg.splitlines(): errmsg = str(e)
log.msg('[EE] %s' % line) for line in errmsg.splitlines():
log.msg('[EE] %s' % line)
except Exception:
log.msg('[EE] %s' % errmsg )
def log_errmsg(errmsg): def log_errmsg(errmsg):
""" """
Prints/logs an error message to the server log. Prints/logs an error message to the server log.

View file

@ -204,7 +204,7 @@ $(document).keypress( function(event) {
} }
else { else {
if (wresult == 38 || wresult == 40) { if (wresult == 38 || wresult == 40) {
// this fixes a bug in firefox, those are on ASCII format // this fixes a bug in firefox, those are on ASCII format
return false; return false;
} }