All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Removed dependency on
sentinel-value.
- Dropped support for Python 3.8 & 3.9.
- Component key type-hints now use
TypeForm. Complex component types which already worked at runtime are now recognized by type linters.
Maintenance release
- Allow setting the
traversestate of anentity.component_tags[type][entity](traverse=...)attribute.
- Updated deprecations to use PEP 702.
- Fixed
.clearmethods forentity.componentsandentity.component_relations.
- New query
.any_ofmethod. This was possible before but it is easier with this method.
- Clearing an entity with inherited components no longer leaves the entity with missed components.
- Clearing an entity with inherited tags no longer hangs.
EntityComponents.popnow correctly returns defaults when the components are inherited instead of local.
- Fixed type of default parameter for
EntityComponents.get.
- Queries are now truthy if they match any entity.
- Renamed
Worldto the more standard nameRegistryin multiple places.
Worldis nowRegistryWorldQueryis nowBoundQuery.worldattributes ofEntityandBoundQueryare now.registry
- Updated
EntityComponents.__ior__type hints which were causing false positives.
- Added the
tcod.ecs.IsAsentinel value. - Entities will automatically inherit components/tags/relations from entities they have an
IsArelationship with. #15 - Entities can be used as prefabs, use
Entity.instantiate()to make a new entities inheriting the base entities components/tags/relations.
tcod.ecs.query.Queryremoved due to a refactor.abstract_componentdecorator removed.
- Fix for
x in Entity.relation_tags_manynot checking the correct values.
- Added
WorldQuery.get_entitiesfor returning query results as a set.
- Removed an optimization which would check the equality of component values, since this would fail when comparing some types such as NumPy arrays.
- Removed unintentional iteration behavior from
World. #8
- Relation component lookup tables were replacing previous entries instead of adding to them.
- Relation ellipsis lookup tables were discarding entities which still had a relevant relation.
tcod.ecs.typing.ComponentKeyis now stable.- Can now register a callback to be called on component changes.
- Fixed stale caches for relation components.
- Unpickled worlds had reversed relations from what were saved.
Entity.relation_componentsnow hasMutableMappingfunctionality.- You can now set the value of
Entity.relation_components[component_key] = {target: component}. - Added the
Entity.clearmethod which effectively deletes an entity by removing its components/tags/relations. This does not delete relations targeting the cleared entity.
- Now supports giving a query to another relation query, allowing conditional and chained relation queries. #1
- The type returned by
World.Qhas been renamed fromtcod.ecs.Querytotcod.ecs.query.WorldQuery. - Serialization format updated.
- Added a simple query cache. A query is automatically cached until any of the components/tags/relations it depends on have changed.
- Serialization format updated, older versions will not be able to unpickle this version.
- Reduced the size of the pickled World.
- Missing components in
Entity.componentsnow returns the missing key in the KeyError exception instead of the entity. - Backwards relations for querying were not cleared on relation deletions.
Entity.componentsnow supports the|=assignment operator.
Entity.tagsnow supports the|=and-=assignment operators.
- Warn if a string is passed directly as a tags parameter, which might cause unexpected behavior.
Entity.relation_tagshas been renamed toEntity.relation_tag.
- Deprecated the renamed attribute
Entity.relation_tag.
World.new_entitycan now take aMappingas thecomponentsparameter.
- Implicit keys for components have been deprecated in all places.
- The names feature has been deprecated.
Entity.components.by_name_typehas been deprecated.
World.global_has been deprecated sinceworld[None]is simpler and less redundant.
Entity.components.by_name_type(name_type, component_type)to iterate over named components with names of a specific type.
- Remap
World.global_touid=None.
- You can now use custom identifiers for entity objects.
You can access these from World instances with
entity = world[uid].
- Dropped support for unpickling v1.0 World objects.
- Allow
Entityinstances to be referenced weakly.
- Added missing typing marker.
- Corrected the type-hinting of
Entity.component.getandEntity.component.setdefault.
- World's now have a globally accessible entity accessed with
World.global_.
- You can now quickly lookup the relation tags and relation component keys of an entity.
First stable release.