Closed timjbrown closed 1 year ago
Hi @timjbrown , did you set the EntityType.CUE as state as well? If you add an enum type object as a component is fine, but if you want to check a particular value you have to set the enum value as a state: https://github.com/dominion-dev/dominion-ecs-java/blob/main/dominion-ecs-api/README.md#class-entity
No it wasn't clear to me how states worked. I thought it referred to the state of components that already exist not an extra idea of state separate on top of that. What would you say is the canonical way to do this in Dominion? To get the CUE ball in this example? By setState() and withState()?
Ok, this is the general rule: add a component -> you can query to find all entities that have that specific component type; set a state -> you can filter all entities, which you have already found by component type, looking for a particular state (enum value)
This is an enum I'm using to categorize entities.
When I do
cueResult has size() 18 and contains With1[comp=CUE, entity=Entity={id=|0:5:0|-> [CUE, java.awt.Color[r=255,g=255,b=255], models.Transform2@3d75a2cf, colliders.ColliderComponent@788dcd3c, bodies.Body@55dc666e, components.TagCue@6ef8985a], stateId=|1:0:0|, enabled=true}]
When I do
cueResult has size 0
Either I don't understand what withState() is intended to do or there is a bug.
In the meantime I've just used a tag class to accomplish the same goal