From 3d94fab1f5cf849709a51cfb1ce151e77af942a7 Mon Sep 17 00:00:00 2001 From: InspectorCaracal <51038201+InspectorCaracal@users.noreply.github.com> Date: Thu, 7 Apr 2022 14:30:15 -0600 Subject: [PATCH] combine id and key+alias string for key --- evennia/contrib/rpg/rpsystem/rpsystem.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/evennia/contrib/rpg/rpsystem/rpsystem.py b/evennia/contrib/rpg/rpsystem/rpsystem.py index d6085e1bfd..083d664976 100644 --- a/evennia/contrib/rpg/rpsystem/rpsystem.py +++ b/evennia/contrib/rpg/rpsystem/rpsystem.py @@ -318,15 +318,16 @@ def regex_tuple_from_key_alias(obj): """ global _REGEX_TUPLE_CACHE + permutation_string = " ".join([obj.key] + obj.aliases.all()) + cache_key = " ".join((obj.id, permutation_string)) - if obj.id not in _REGEX_TUPLE_CACHE: - permutation_string = " ".join([obj.key] + obj.aliases.all()) - _REGEX_TUPLE_CACHE[obj.id] = ( + if cache_key not in _REGEX_TUPLE_CACHE: + _REGEX_TUPLE_CACHE[cache_key] = ( re.compile(ordered_permutation_regex(permutation_string), _RE_FLAGS), obj, obj.key, ) - return _REGEX_TUPLE_CACHE[obj.id] + return _REGEX_TUPLE_CACHE[cache_key] def parse_language(speaker, emote):