Many API changes to simplify the framework.
Fixes
- Changed
Entity()constructor to use add behavior with initial components, instead of update behavior - error on duplicates
API Updates
- New tag components feature. Use component classes marked with
@tagdecorator to dynamically filter queries more- Added
tagandtagskeyword parameters toEntityManager.query() - Added
EntityManagertagged()andtagged_ids()methods - Component events will also give the component itself as an event key, if the component is a tag
QueryResultinstances have a read-onlytagsattribute- New
tag_componentmodule withtag_types(WeakSet) andtag(decorator)
- Added
space.query()removed. Usespace.entities.query()instead- Removed event skip functionality of handler callbacks
- Callback return value is now ignored
process()methods returnNoneinstead of abool
- Systems now should be modules (type
ModuleType) - Key handlers are now invoked with separate priority sorting from non-key handlers, to avoid the need for sorting
- Renamed
pyriak.eventkeymodule topyriak.event_key set_key()now has another available overload with 2 arguments, to set key functions directly without using as a decoratorspace.post()now only takes one argument, instead of a variable numberkey_functionsis now a directWeakKeyDictionary, typed as aMapping- Removed
EventKeyFunctionsclass
- Removed
Internal
_EventHandlernow supports rich comparison by priority, for native sorting capability onlyEntityManagernow stores and maintains a_tag_cache- Removed
SystemManagerhandler sorting methods and features - Simplified
EntityManageradd()andremove() - Simplified
space.pump() - Greatly simplified
SystemManager._get_bindings() - Rearranged order of attributes of
_EventHandler - Use
repr()formatting instead ofstr()formatting in error message f-strings for types - Added
ISC001ruff rule
Typing
- Removed some unused
type: ignorecomments _CallbackandBindingare no longer generic on the callback return type
Other
- Improved README
- Updated docstrings
- Changed formatting of docstring code examples
- License year range updated