bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Handle TriggerTargets that are combinations for components/entities

Open cBournhonesque opened this issue 1 year ago • 3 comments

Objective

  • Fixes https://github.com/bevyengine/bevy/issues/14074
  • It is currently not possible to issues a trigger that targets a specific list of components AND a specific list of entities

Solution

  • We can now use ((A, B), (entity_1, entity_2)) as a trigger target, as well as the reverse

Testing

  • Added a unit test. The triggering rules for observers are quite confusing:
  • triggers once per entity target
  • for each entity target, an observer system triggers if any of its components matches the trigger target components (but it triggers at most once, since we use an internal counter to make sure that an observer can run at most once per entity target)

cBournhonesque avatar Jul 31 '24 20:07 cBournhonesque

The triggering rules for observers are quite confusing:

I'd like to see more docs explicitly explaining this.

alice-i-cecile avatar Aug 01 '24 00:08 alice-i-cecile

The triggering rules for observers are quite confusing:

I'd like to see more docs explicitly explaining this.

This should be independent from this PR I think, right? Here i'm just adding the possibility to have more flexible trigger targets

cBournhonesque avatar Aug 24 '24 20:08 cBournhonesque

Kind of wondering if we shouldn't cut this from 0.15 for stability.

NthTensor avatar Oct 08 '24 19:10 NthTensor

Adopted in #16326

BenjaminBrienen avatar Nov 10 '24 09:11 BenjaminBrienen