diff --git a/CHANGELOG.md b/CHANGELOG.md index b1871540d5..d5f2b1c717 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## Main branch + +- [Fix][pull3267]: Missing recache step in ObjectSessionHandler (InspectorCaracal) +- [Fix][pull3270]: Evennia is its own MSSP family now, so we should return that + instead of 'Custom' (InspectorCaracal) +- [Fix][pull3274]: Traceback when creating objects with initial nattributes + (InspectorCaracal) + +[pull3267]: https://github.com/evennia/evennia/pull/3267 +[pull3270]: https://github.com/evennia/evennia/pull/3270 +[pull3274]: https://github.com/evennia/evennia/pull/3274 + ## Evennia 2.3.0 Sept 3, 2023 diff --git a/evennia/contrib/tutorials/evadventure/ai.py b/evennia/contrib/tutorials/evadventure/ai.py index 913379f0fd..6b08917d6e 100644 --- a/evennia/contrib/tutorials/evadventure/ai.py +++ b/evennia/contrib/tutorials/evadventure/ai.py @@ -126,6 +126,11 @@ class AIHandler: def __init__(self, obj): self.obj = obj + if hasattr(self, "AI_STATES"): + # load AI dict from typeclass core if it exists - allows for setting it + # on the typeclass directly. + self.add_aidict(self.AI_STATES) + def __str__(self): return f"AIHandler for {self.obj}. Current state: {self.state}" @@ -156,7 +161,8 @@ class AIHandler: object: Randomly chosen element from choices. """ - return random.choices(choices, odds)[0] + if choices: + return random.choices(choices, odds)[0] @staticmethod def _weighted_choice_dict(choices): @@ -352,4 +358,7 @@ class AIHandler: return # perform the action - getattr(self.obj, f"ai_{self.state}")(next_action) + try: + getattr(self.obj, f"ai_{self.state}")(next_action) + except AttributeError: + logger.log_err(f"AIHandler: {self.obj} has no ai_{self.state} method.") diff --git a/evennia/utils/utils.py b/evennia/utils/utils.py index 36c7716372..4a2d6ead45 100644 --- a/evennia/utils/utils.py +++ b/evennia/utils/utils.py @@ -27,6 +27,7 @@ from os.path import join as osjoin from string import punctuation from unicodedata import east_asian_width +import evennia from django.apps import apps from django.conf import settings from django.core.exceptions import ValidationError as DjangoValidationError @@ -34,8 +35,6 @@ from django.core.validators import validate_email as django_validate_email from django.utils import timezone from django.utils.html import strip_tags from django.utils.translation import gettext as _ - -import evennia from evennia.utils import logger from simpleeval import simple_eval from twisted.internet import reactor, threads @@ -1064,7 +1063,9 @@ def server_services(): """ - if hasattr(evennia.SESSION_HANDLER, "server") and hasattr(evennia.SESSION_HANDLER.server, "services"): + if hasattr(evennia.SESSION_HANDLER, "server") and hasattr( + evennia.SESSION_HANDLER.server, "services" + ): server = evennia.SESSION_HANDLER.server.services.namedServices else: # This function must be called from inside the evennia process. @@ -1976,7 +1977,6 @@ def format_grid(elements, width=78, sep=" ", verbatim_elements=None, line_prefi ic = 0 row = "" for ie, element in enumerate(elements): - wl = wls[ie] lrow = display_len((row)) # debug = row.replace(" ", ".")