Different systems with the same family filter receive different entities.
See original GitHub issuepackage in.zumikua.stg;
import com.badlogic.ashley.core.*;
import com.badlogic.ashley.utils.ImmutableArray;
public class Test {
static public void main(String[] args) {
Engine engine = new Engine();
engine.addSystem(new SystemAddEntity());
engine.addSystem(new SystemAttachComponent());
engine.addSystem(new SystemC());
engine.update(1);
}
static class A implements Component {
}
static class B implements Component {
}
static class SystemAddEntity extends EntitySystem {
SystemAddEntity() {
super(0);
}
boolean added = false;
@Override
public void update(float deltaTime) {
super.update(deltaTime);
if(!added) {
getEngine().addEntity(new Entity().add(new A()));
added = true;
}
}
}
static class SystemAttachComponent extends EntitySystem implements EntityListener {
private ImmutableArray<Entity> entities;
SystemAttachComponent() {
super(1);
}
@Override
public void addedToEngine(Engine engine) {
super.addedToEngine(engine);
engine.addEntityListener(Family.all(A.class).exclude(B.class).get(), this);
entities = engine.getEntitiesFor(Family.all(A.class, B.class).get());
}
@Override
public void update(float deltaTime) {
super.update(deltaTime);
System.out.println("SystemAttachComponent " + entities.size()); // outputs 0
}
@Override
public void entityAdded(Entity entity) {
entity.add(new B());
}
@Override
public void entityRemoved(Entity entity) {
}
}
static class SystemC extends EntitySystem {
private ImmutableArray<Entity> entities;
SystemC() {
super(2);
}
@Override
public void addedToEngine(Engine engine) {
super.addedToEngine(engine);
entities = engine.getEntitiesFor(Family.all(A.class, B.class).get());
}
@Override
public void update(float deltaTime) {
super.update(deltaTime);
System.out.println("SystemC " + entities.size()); //outputs 1
}
}
}
With the above code, SystemAttachComponent receives zero entities, but SystemC receives one entity, is this a bug or an intended behavior?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Entity filters - ServiceNow Docs
Entity types enable you to find and create entities that match a set of filter conditions. Entity types include predefined entity filters that...
Read more >Internet Service Provider Content Filtering
Every other year, the Division must request information from each Internet ... This service does the same filtering as OpenDNS Family shield but...
Read more >Parental Control & Internet Filtering Device and App | Meet ...
Circle is the easiest parental control device and app to manage screen time across all your family's connected devices. Keep kids safe online:...
Read more >How to filter a list based on another list using Linq?
Try this: var filtered = listOfAllVenues .Where(x=>!listOfBlockedVenues.Any(y=>y.VenueId == x.Id));. It will get all Venues where Id is not in blockedVenues ...
Read more >A Survey of Blocking and Filtering Techniques for Entity ... - arXiv
Hence, Blocking and Filtering share the same goal, but are complementary, as they operate under different settings and assumptions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@metaphore i’ll improve the javadoc, it’s a bit confusing indeed 😃
Sorry for my late reply, I’m using
1.7.3
, which is bundled with the newest(I guess) gdx-setup. Maybe gdx-setup needs to be updated? Anyway, thanks for your help ❤️