Artitas_FAQ - GoldhawkInteractive/X2-Modding GitHub Wiki
Short: Don't.
Long: You can do it through World.EntityManager.FindAliveEntities()
. However, this tends to be a sign of bad design as you normally search over functionality (sets of components) using Family. Define a Family, and use Family.Entities()
.
Short: This is by design. They execute after all listeners on all Families have had a chance to react to mutation to the entity that caused the trigger. This is done so an entity can never illegally exists in a Family. (And you don't have to null check on components and/or check for every possible state your entity can be in.)
Long: (Text from Reactive Design)
All changes in Components, and changes emanating from this (add/remove Family, etc) are triggered immediately. The only exception to this is changes on Components made within listeners reacting to a change. These changes are delayed until all listeners are called that want to be notified of a change.
The reason for this is that all listeners are called after a mutation on an Entity. This is done because the state of the Entity needs to be guaranteed to conform to the constraints placed on it for the listeners. In other words: If you add a listener to a Family which requires components A,B & C, the system will enforce that an entity has those components when listeners attached to the family are called. If another listener were to be allowed to remove component A, then any listener coming after it would need to check whether A still existed on the Entity.