From 7566ca1ca2e3e53dbe2aadab1a02a227192b1033 Mon Sep 17 00:00:00 2001 From: "Elijah C. Voigt" Date: Mon, 12 Feb 2024 20:52:32 -0800 Subject: [PATCH] cargo fmt --- src/intro.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/intro.rs b/src/intro.rs index 8aa0c37..6e2bbcf 100644 --- a/src/intro.rs +++ b/src/intro.rs @@ -13,13 +13,17 @@ impl Plugin for IntroPlugin { .init_resource::() .add_systems(OnEnter(GameState::Intro), activate::) .add_systems(OnExit(GameState::Intro), deactivate::) - .add_systems(Update, manage_intro_progress - .run_if(in_state(GameState::Intro)) - .run_if(not(resource_exists::())) + .add_systems( + Update, + manage_intro_progress + .run_if(in_state(GameState::Intro)) + .run_if(not(resource_exists::())), ) - .add_systems(Update, play_intro - .run_if(in_state(GameState::Intro)) - .run_if(resource_changed::()) + .add_systems( + Update, + play_intro + .run_if(in_state(GameState::Intro)) + .run_if(resource_changed::()), ) // Continue to play state if the intro is done playing out .add_systems( @@ -89,9 +93,9 @@ fn init_intro_text( fn manage_intro_progress( keys: Res>, mut start: Local, - mut progress: ResMut, + mut progress: ResMut, framecount: Res, - mut commands: Commands, + mut commands: Commands, tweaks_file: Res, tweaks: Res>, ) { @@ -103,12 +107,10 @@ fn manage_intro_progress( // If the user hits 'return' set this to the end of the animation if keys.just_pressed(KeyCode::Return) { progress.0 = usize::MAX; - commands.insert_resource(IntroPlayed); + commands.insert_resource(IntroPlayed); // Otherwise progress by N characters (1) } else { - let tweak = tweaks - .get(tweaks_file.handle.clone()) - .expect("Load tweaks"); + let tweak = tweaks.get(tweaks_file.handle.clone()).expect("Load tweaks"); let rate = tweak.get::("intro_rate").expect("[intro] rate = #"); progress.0 = ((framecount.0 - *start) / rate) as usize; @@ -117,9 +119,9 @@ fn manage_intro_progress( // Upon entering the Intro state, start the intro "animation" fn play_intro( - mut text: Query<(&mut Text, &mut Visibility), With>, + mut text: Query<(&mut Text, &mut Visibility), With>, progress: Res, - mut commands: Commands, + mut commands: Commands, ) { // Iterate over all (one) text text.iter_mut().for_each(|(mut t, mut v)| { @@ -133,9 +135,7 @@ fn play_intro( .iter_mut() .enumerate() // Only operate on sections up to this point - .filter_map(|(i, s)| { - (i <= progress.0).then_some(s) - }) + .filter_map(|(i, s)| (i <= progress.0).then_some(s)) // Set the alpha to 1.0 making it visible .for_each(|s| { s.style.color.set_a(1.0);