Module iyes_loopless::condition
source · [−]Expand description
Conditional systems supporting multiple run conditions
This is an alternative to Bevy’s Run Criteria, inspired by Bevy’s ChainSystem
and the Stageless RFC.
Run Conditions are systems that return bool
.
Any system can be converted into a ConditionalSystem
(by calling .into_conditional()
), allowing
run conditions to be added to it. You can add as many run conditions as you want to a ConditionalSystem
,
by using the .run_if(condition)
builder method.
The ConditionalSystem
with all its conditions behaves like a single system at runtime.
All of the data access (from all the system params) will be combined together.
When it runs, it will run each condition, and abort if any of them returns false
.
The main system will only run if all conditions return true
.
It is highly recommended that all your conditions only access data immutably. Avoid mutable access or locals in condition systems, unless are really sure about what you are doing. If you add the same condition to many systems, it will run with each one.
Structs
Represents an ExclusiveSystem
that is governed by Run Condition systems.
Represents a System
that is governed by Run Condition systems.
Traits
Extension trait for conditional exclusive systems
Extension trait allowing any system to be converted into a ConditionalSystem