Replies: 1 comment
-
well, you already mentioned moving the conditions in variables. So here is a macro-based suggestion. macro_rules! and {
// so-called disjunction (plain name)
(@or $or_cond:ident ) => {
$or_cond
};
// so-called disjunction (parenthestised)
(@or ( $or_head:ident $(, $or_tail:ident)* ) ) => {
$or_head $(.or_else( $or_tail ))*
};
// so-called conjonction
( $and_head:tt $(, $and_tail:tt)* ) => {
and!(@or $and_head ) $(.and_then(and!(@or $and_tail )))*
}
} Let's see the result: let condition = and!(
is_computer_running,
is_monitor_connected,
(is_mouse_moved, is_keyboard_pressed)
);
// ...
funny_little_task
.pipe(process_result)
.run_if(condition)
.in_set(FunnyLittleSet), Not bad at all! However, I think it's not much really a gain compared to just moving the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello fellow bevy folks,
I'm thrilled to share my excitement about the latest bevy 0.10 release, which introduced a fantastic new feature: run conditions. After spending some time testing and using them extensively, I have fallen in love with their capabilities. They have significantly improved many of my existing systems. However, I've reached a point where I'm using run conditions almost excessively, and it's starting to become messy. My app/plugin setups now look like this:
While the system configuration itself is perfectly readable on its own, adding a lot of these configured systems results in a cluttered app/plugin setup section. That's especially the case if the system names are a bit more descriptive than in the example above. I've tried using variables and functions to organize them, but it doesn't seem to improve the situation. Instead, it feels like I'm just moving the mess elsewhere. I'm also splitting up my app into a lot of small plugins already, but even those are looking messy. So, I have a question for all of you:
Has anyone discovered an effective way to organize system setups like this?
I'm eager to hear your thoughts, ideas, and experiences on how we can simplify this run condition complexity and streamline our code!
Beta Was this translation helpful? Give feedback.
All reactions