mirror of
https://github.com/evennia/evennia.git
synced 2026-03-26 17:56:32 +01:00
Fixed bugs in scripts starting and with multiple aliases getting a malformed tag category.
This commit is contained in:
parent
24aa626a61
commit
9839e0ba1f
3 changed files with 18 additions and 13 deletions
|
|
@ -1654,6 +1654,8 @@ class CmdExamine(ObjManipCommand):
|
|||
elif not perms:
|
||||
perms = ["<None>"]
|
||||
string += "\n{wPlayer Perms{n: %s" % (", ".join(perms))
|
||||
if obj.player.attributes.has("_quell"):
|
||||
string += " {r(quelled){n"
|
||||
string += "\n{wTypeclass{n: %s (%s)" % (obj.typeclass.typename,
|
||||
obj.typeclass_path)
|
||||
if hasattr(obj, "location"):
|
||||
|
|
@ -1685,11 +1687,13 @@ class CmdExamine(ObjManipCommand):
|
|||
if not (len(obj.cmdset.all()) == 1 and obj.cmdset.current.key == "Empty"):
|
||||
# list the current cmdsets
|
||||
all_cmdsets = (obj.cmdset.all() +
|
||||
(hasattr(obj, "player") and
|
||||
(hasattr(obj, "player") and obj.player and
|
||||
obj.player and obj.player.cmdset.all() or []))
|
||||
all_cmdsets += (hasattr(obj, "sessid") and
|
||||
hasattr(obj, "player") and
|
||||
obj.player.get_session(obj.sessid).cmdset.all())
|
||||
try:
|
||||
# we have to protect this since many objects don't have player/sessions.
|
||||
all_cmdsets += obj.player.get_session(obj.sessid).cmdset.all()
|
||||
except (TypeError, AttributeError):
|
||||
pass
|
||||
all_cmdsets.sort(key=lambda x: x.priority, reverse=True)
|
||||
string += "\n{wStored Cmdset(s){n:\n %s" % ("\n ".join("%s [%s] (prio %s)" % \
|
||||
(cmdset.path, cmdset.key, cmdset.priority)
|
||||
|
|
|
|||
|
|
@ -154,9 +154,10 @@ class ScriptClass(TypeClass):
|
|||
if obj:
|
||||
# check so the scripted object is valid and initalized
|
||||
try:
|
||||
object.__getattribute__(obj, 'cmdset')
|
||||
object.__getattribute__(obj.dbobj, 'cmdset')
|
||||
except AttributeError:
|
||||
# this means the object is not initialized.
|
||||
logger.log_trace()
|
||||
self.dbobj.is_active = False
|
||||
return 0
|
||||
|
||||
|
|
|
|||
|
|
@ -505,21 +505,21 @@ class TagHandler(object):
|
|||
"Add a new tag to the handler. Tag is a string or a list of strings."
|
||||
for tagstr in make_iter(tag):
|
||||
tagstr = tagstr.strip().lower() if tagstr is not None else None
|
||||
category = "%s%s" % (self.prefix, category.strip().lower() if category is not None else "")
|
||||
categ = "%s%s" % (self.prefix, category.strip().lower() if category is not None else "")
|
||||
data = str(data) if data is not None else None
|
||||
# this will only create tag if no matches existed beforehand (it
|
||||
# will overload data on an existing tag since that is not
|
||||
# considered part of making the tag unique)
|
||||
tagobj = Tag.objects.create_tag(key=tagstr, category=category, data=data)
|
||||
tagobj = Tag.objects.create_tag(key=tagstr, category=categ, data=data)
|
||||
_GA(self.obj, self._m2m_fieldname).add(tagobj)
|
||||
if self._cache is None:
|
||||
self._recache()
|
||||
self._cache[tagstr] = True
|
||||
self._cache[tagstr] = tagobj
|
||||
|
||||
def get(self, key, category="", return_obj=False):
|
||||
def get(self, key, category="", return_data=False):
|
||||
"""
|
||||
Get the data field for the given tag or list of tags. If
|
||||
return_obj=True, return the matching Tag objects instead.
|
||||
Get the tag for the given key or list of tags. If
|
||||
return_data=True, return the matching Tag objects instead.
|
||||
"""
|
||||
if self._cache is None or not _TYPECLASS_AGGRESSIVE_CACHE:
|
||||
self._recache()
|
||||
|
|
@ -528,11 +528,11 @@ class TagHandler(object):
|
|||
if category is not None else "")
|
||||
ret = [val for val in (self._cache.get(keystr.strip().lower())
|
||||
for keystr in make_iter(key)) if val]
|
||||
ret = ret if return_obj else [to_str(tag.db_data) for tag in ret if tag]
|
||||
ret = [to_str(tag.db_data) for tag in ret] if return_data else ret
|
||||
return ret[0] if len(ret) == 1 else ret
|
||||
|
||||
def remove(self, tag, category=None):
|
||||
"Remove a tag from the handler"
|
||||
"Remove a tag from the handler, where tag is the key of the tag to remove"
|
||||
if self._cache is None or not _TYPECLASS_AGGRESSIVE_CACHE:
|
||||
self._recache()
|
||||
for tag in make_iter(tag):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue