From 62ff667f9a6d506a1f56e11e757ffc33620e2405 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 26 Nov 2023 13:13:05 +0100 Subject: [PATCH] Make input func `monitor` support attribute categories. Resolve #3307 --- CHANGELOG.md | 3 +++ evennia/scripts/monitorhandler.py | 2 +- evennia/server/inputfuncs.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3741ff6230..46cec18d31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ `at_post_create_character` methods to allow better customization of character creation (Volund) - [Feature][pull3319]: Refactor/cleanup of Evennia server/portal startup files into services for easier overriding (Volund) +- [Feature][issue3307]: Add support for Attribute-categories when using the monitorhandler + with input funcs to monitor Attribute changes. - [Fix][pull3197]: Make sure Global scripts only start in one place, - [Fix][pull3324]: Make account-post-login-fail signal fire properly. Add `CUSTOM_SIGNAL` for adding one's own signals (Volund) @@ -60,6 +62,7 @@ [pull3338]: https://github.com/evennia/evennia/pull/3338 [issue3272]: https://github.com/evennia/evennia/issues/3272 [issue3273]: https://github.com/evennia/evennia/issues/3273 +[issue3308]: https://github.com/evennia/evennia/issues/3307 ## Evennia 2.3.0 diff --git a/evennia/scripts/monitorhandler.py b/evennia/scripts/monitorhandler.py index 07e9d04f25..78ad71e77d 100644 --- a/evennia/scripts/monitorhandler.py +++ b/evennia/scripts/monitorhandler.py @@ -153,7 +153,7 @@ class MonitorHandler(object): """ if not fieldname.startswith("db_") or not hasattr(obj, fieldname): # an Attribute - we track its db_value field - obj = obj.attributes.get(fieldname, return_obj=True) + obj = obj.attributes.get(fieldname, category=category, return_obj=True) if not obj: return fieldname = self._attr_category_fieldname("db_value", category) diff --git a/evennia/server/inputfuncs.py b/evennia/server/inputfuncs.py index 6cba74f78a..2a4a135136 100644 --- a/evennia/server/inputfuncs.py +++ b/evennia/server/inputfuncs.py @@ -445,6 +445,7 @@ def monitor(session, *args, **kwargs): name = kwargs.get("name", None) outputfunc_name = kwargs("outputfunc_name", "monitor") + category = kwargs.get("category", None) if name and name in _monitorable and session.puppet: field_name = _monitorable[name] obj = session.puppet @@ -461,6 +462,7 @@ def monitor(session, *args, **kwargs): name=name, session=session, outputfunc_name=outputfunc_name, + category=category, )