Make input func monitor support attribute categories. Resolve #3307

This commit is contained in:
Griatch 2023-11-26 13:13:05 +01:00
parent af896b385a
commit 62ff667f9a
3 changed files with 6 additions and 1 deletions

View file

@ -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

View file

@ -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)

View file

@ -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,
)