Fixed errors due to the removal of execute_cmd("look") calls in the
latest revisions - this turns out to bypass the normal use of cmdsets to control things like the dark room in the tutorial. Resolves the second mentioned error in #889.
This commit is contained in:
parent
97f2cf1757
commit
03d415beb1
3 changed files with 27 additions and 12 deletions
|
|
@ -52,7 +52,7 @@ class ContentsHandler(object):
|
|||
|
||||
"""
|
||||
self._pkcache.update(dict((obj.pk, None) for obj in
|
||||
ObjectDB.objects.filter(db_location=self.obj)))
|
||||
ObjectDB.objects.filter(db_location=self.obj) if obj.pk))
|
||||
|
||||
def get(self, exclude=None):
|
||||
"""
|
||||
|
|
@ -65,16 +65,22 @@ class ContentsHandler(object):
|
|||
objects (list): the Objects inside this location
|
||||
|
||||
"""
|
||||
pks = list(self._pkcache)
|
||||
if exclude:
|
||||
pks = [pk for pk in pks if pk not in [excl.pk for excl in make_iter(exclude)]]
|
||||
pks = [pk for pk in self._pkcache if pk not in [excl.pk for excl in make_iter(exclude)]]
|
||||
else:
|
||||
pks = self._pkcache
|
||||
try:
|
||||
return [self._idcache[pk] for pk in pks]
|
||||
except KeyError:
|
||||
# this can happen if the idmapper cache was cleared for an object
|
||||
# in the contents cache. If so we need to re-initialize and try again.
|
||||
self.init()
|
||||
return self.get(exclude=exclude)
|
||||
try:
|
||||
return [self._idcache[pk] for pk in pks]
|
||||
except KeyError:
|
||||
# this means an actual failure of caching. Return real database match.
|
||||
logger.logerr("contents cache failed for %s." % (self.obj.key))
|
||||
return list(ObjectDB.objects.filter(db_location=self.obj))
|
||||
|
||||
def add(self, obj):
|
||||
"""
|
||||
|
|
@ -102,7 +108,7 @@ class ContentsHandler(object):
|
|||
|
||||
"""
|
||||
self._pkcache = {}
|
||||
self._init()
|
||||
self.init()
|
||||
|
||||
#------------------------------------------------------------
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1418,7 +1418,8 @@ class DefaultCharacter(DefaultObject):
|
|||
We make sure to look around after a move.
|
||||
|
||||
"""
|
||||
self.msg(self.at_look(self.location))
|
||||
if self.location.access(self, "view"):
|
||||
self.msg(self.at_look(self.location))
|
||||
|
||||
def at_pre_puppet(self, player, session=None):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue