From ba4414226f42a9da36741a6d7f75d8c820633629 Mon Sep 17 00:00:00 2001 From: "Elijah C. Voigt" Date: Wed, 22 May 2024 19:26:57 -0700 Subject: [PATCH] Change all logging from info!/warn! to debug! --- src/ai.rs | 8 ++++---- src/audio.rs | 8 ++++---- src/display3d.rs | 7 +++---- src/game.rs | 28 +++++++++++++++------------- src/intro.rs | 14 +++++++------- src/loading.rs | 4 ++-- src/main.rs | 2 +- src/menu.rs | 2 +- src/tutorial.rs | 6 +++--- 9 files changed, 40 insertions(+), 39 deletions(-) diff --git a/src/ai.rs b/src/ai.rs index d60993b..b3a965e 100644 --- a/src/ai.rs +++ b/src/ai.rs @@ -75,8 +75,8 @@ fn bogo_ai_thinking( if !timer.finished() { timer.tick(time.delta()); } else { - info!("AI finished thinking"); - info!("Timer: {:?}", timer); + debug!("AI finished thinking"); + debug!("Timer: {:?}", timer); // TODO: Assuming AI is Side::A let ai_side = Side::A; @@ -151,8 +151,8 @@ fn bogo_ai_holding( if !timer.finished() { timer.tick(time.delta()); } else { - info!("AI Holding"); - info!("Timer: {:?}", timer); + debug!("AI Holding"); + debug!("Timer: {:?}", timer); // Apply selected moves board diff --git a/src/audio.rs b/src/audio.rs index 31af116..2eda3e3 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -110,7 +110,7 @@ fn audio_trigger( .iter() .filter(|(_, _, source_event)| **source_event == AudioEvent::Idle) .for_each(|(entity, source, _)| { - info!("Stopping audio {}", event_str); + debug!("Stopping audio {}", event_str); source.stop(); commands.entity(entity).despawn_recursive(); }); @@ -121,7 +121,7 @@ fn audio_trigger( .iter() .filter(|(_, _, source_event)| **source_event == AudioEvent::MainMusic) .for_each(|(entity, source, _)| { - info!("Stopping audio {}", event_str); + debug!("Stopping audio {}", event_str); source.stop(); commands.entity(entity).despawn_recursive(); }); @@ -136,7 +136,7 @@ fn audio_trigger( } } } else { - warn!("No music set for {:?} in {:?}", event, state); + debug!("No music set for {:?} in {:?}", event, state); } } }); @@ -182,7 +182,7 @@ fn set_intensity( .iter() .filter(|(_, event)| **event == AudioEvent::MainMusic) .for_each(|(source, _)| { - info!("Setting music intensity to {:?}", value); + debug!("Setting music intensity to {:?}", value); source .event_instance .set_parameter_by_name("Intensity", value, true) diff --git a/src/display3d.rs b/src/display3d.rs index 3ddc7c2..25498e3 100644 --- a/src/display3d.rs +++ b/src/display3d.rs @@ -510,7 +510,7 @@ fn update_tweaks( tweaks: Res>, ) { if let Some(tweak) = tweaks.get(tweaks_file.handle.clone()) { - warn!("Updating tweaks!"); + debug!("Updating tweaks!"); camera_settings .iter_mut() .for_each(|(mut skybox, mut environment_map_light)| { @@ -567,7 +567,7 @@ fn set_models( if active_animation_players .iter_many(children.iter_descendants(entity)) .count() > 0 { - info!("Piece {:?} is animating. Skipping...", entity); + debug!("Piece {:?} is animating. Skipping...", entity); } else { let scene = tweak.get::(key).unwrap(); let new_handle = gltf.named_scenes.get(scene.as_str()).expect("Game board model"); @@ -1042,7 +1042,7 @@ fn vantage_point( .unwrap(); let gltf = gltfs.get(assets_handle).expect("Load GLTF content"); players.iter_mut().for_each(|mut player| { - info!("Getting a better view"); + debug!("Getting a better view"); // play down events on state transitions let animation_key = if !*up { @@ -1296,7 +1296,6 @@ fn dissolve_animation( entity, percentage ); - // info!("Removing dissolving marker from {:?}", entity); commands.entity(entity).remove::(); } }); diff --git a/src/game.rs b/src/game.rs index d3016be..b1dfa15 100644 --- a/src/game.rs +++ b/src/game.rs @@ -510,7 +510,7 @@ impl Board { } } - info!("Remaining moves: {:?}", self.moves); + debug!("Remaining moves: {:?}", self.moves); return moves; } @@ -1105,7 +1105,7 @@ pub(crate) fn update_board( match to { // If we are moving on the board... Some(to_idx) => { - info!("Moving piece {:?} {:?} -> {:?}", entity, from, to_idx); + debug!("Moving piece {:?} {:?} -> {:?}", entity, from, to_idx); // Update the piece's index *index = *to_idx; // Play audio sfx @@ -1125,7 +1125,7 @@ pub(crate) fn update_board( } let ns = !*curr_state.get(); - info!("Piece moved, switching sides: {:?}", ns); + debug!("Piece moved, switching sides: {:?}", ns); next_state.set(ns); } } @@ -1133,7 +1133,7 @@ pub(crate) fn update_board( None => { match move_type { MoveType::Capture => { - info!("Capturing piece {:?}", entity); + debug!("Capturing piece {:?}", entity); commands .entity(entity) .remove::() @@ -1390,7 +1390,7 @@ fn handle_selection( .iter() .filter(|(_, this_index)| *this_index == index) .for_each(|(piece, piece_index)| { - info!("Selecting {:?} at {:?}", piece, piece_index); + debug!("Selecting {:?} at {:?}", piece, piece_index); commands.entity(piece).insert(Selected); if !(*done) { audio_event.send(audio::AudioEvent::PickUp); @@ -1409,7 +1409,7 @@ fn handle_selection( match board.move_piece(*current_index, *index) { Ok(moves) => { // De-select the piece - info!("Applying moves {:?}", moves); + debug!("Applying moves {:?}", moves); if !(*done) { moves.iter().for_each(|m| { move_events.send(m.clone()); @@ -1417,9 +1417,9 @@ fn handle_selection( *done = true; } } - Err(GameError::NullMove) => warn!("Null move!"), + Err(GameError::NullMove) => debug!("Null move!"), Err(GameError::InvalidIndex) | Err(GameError::InvalidMove) => { - warn!("Invalid index/move!"); + debug!("Invalid index/move!"); if !(*done) { audio_event.send(AudioEvent::Invalid); *done = true; @@ -1442,7 +1442,7 @@ fn asserts( ) { if selected_pieces.iter().len() > 2 { selected_pieces.iter().for_each(|e| { - info!("Too many pieces selected, one of which is: {:?}", e); + debug!("Too many pieces selected, one of which is: {:?}", e); }); panic!( "More than two pieces selected {:?}", @@ -1475,7 +1475,7 @@ fn show_valid_moves( // Iterate over all ValidMove entities // For each one with a ValidMove index, make it visible let valid_moves = board.valid_moves(*idx); - info!("Showing valid moves for {:?}: {:?}", idx, valid_moves); + debug!("Showing valid moves for {:?}: {:?}", idx, valid_moves); indicators.iter_mut().for_each(|(i, mut vis)| { if valid_moves.contains(i) { *vis = Visibility::Inherited; @@ -1539,7 +1539,7 @@ fn assert_piece_consistency( let active_count = active.iter().len(); let being_captured_count = being_captured.iter().len(); let captured_count = captured.iter().len(); - info!("Active: {} | being captured: {} | captured: {}", active_count, being_captured_count, captured_count); + debug!("Active: {} | being captured: {} | captured: {}", active_count, being_captured_count, captured_count); let total_count = active_count + being_captured_count + captured_count; assert_eq!(total_count, 18, "Pieces does does not add up!"); } @@ -1565,8 +1565,10 @@ fn undo_move( side = !turn.get().0; } - info!("Reverting move {:?} {:?} -> {:?}", epoch, from, to); - match to { Some(to_idx) => { info!("Moving piece back from {:?}", to_idx); + debug!("Reverting move {:?} {:?} -> {:?}", epoch, from, to); + match to { Some(to_idx) => { + debug!("Moving piece back from {:?}", to_idx); + // Find piece currently at "to_idx" and update it's position to "from" active_pieces .iter_mut() diff --git a/src/intro.rs b/src/intro.rs index 7cf4b48..8db8311 100644 --- a/src/intro.rs +++ b/src/intro.rs @@ -73,7 +73,7 @@ fn set_text_animation_speed( TextAnimationSpeed::default() }; - info!("Set animation speeds {:?}", *animation_speed); + debug!("Set animation speeds {:?}", *animation_speed); } // Draw the intro text (invisible) on startup @@ -157,7 +157,7 @@ fn manage_intro( query: Query, With, Without)>, mut commands: Commands, ) { - info!("Managing intro"); + debug!("Managing intro"); query.iter().for_each(|e| { commands .entity(e) @@ -174,7 +174,7 @@ fn cleanup_intro( tweaks: Res>, mut commands: Commands, ) { - info!("Cleaning up intro"); + debug!("Cleaning up intro"); query.iter().for_each(|e| { commands @@ -222,14 +222,14 @@ fn manage_scroll_text_animation( mut keys: ResMut>, mut mouse: ResMut>, ) { - info!("Managing scroll text animation"); + debug!("Managing scroll text animation"); roots.iter().for_each(|r| { - info!("Processing {:?} at frame {:?}", r, framecount.0); + debug!("Processing {:?} at frame {:?}", r, framecount.0); // Skip to next paragraph only the current paragraph's animation is complete if animated_texts.is_empty() { - info!( + debug!( "No animations playing, moving on to next paragraph {:?}", curr.0 ); @@ -258,7 +258,7 @@ fn manage_scroll_text_animation( // Operate on the next entity in the list curr.0 = paragraphs.next(); - info!("Curr: {:?}", curr.0); + debug!("Curr: {:?}", curr.0); // Progress to the next paragraph if let Some(e) = curr.0 { diff --git a/src/loading.rs b/src/loading.rs index 9f243c5..845ba89 100644 --- a/src/loading.rs +++ b/src/loading.rs @@ -79,8 +79,8 @@ fn loading( .all(|id| server.is_loaded_with_dependencies(id)); if s && g && t && f { - info!("Loading complete after {:?} seconds", time.elapsed_seconds()); - info!("Starting game intro"); + debug!("Loading complete after {:?} seconds", time.elapsed_seconds()); + debug!("Starting game intro"); next_state.set(GameState::Intro) } } diff --git a/src/main.rs b/src/main.rs index cf74049..a9e5079 100644 --- a/src/main.rs +++ b/src/main.rs @@ -89,7 +89,7 @@ pub(crate) enum DisplayState { /// Only runs when state is modified. fn debug_state(mut events: EventReader>) { events.read().for_each(|event| { - info!("State change {:?} -> {:?}", event.before, event.after); + debug!("State change {:?} -> {:?}", event.before, event.after); }) } diff --git a/src/menu.rs b/src/menu.rs index 4cb0b1c..0a2f910 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -46,7 +46,7 @@ fn init_play_menu( tweaks_file: Res, tweaks: Res>, ) { - info!("Initializing Play menu"); + debug!("Initializing Play menu"); let tweak = tweaks.get(tweaks_file.handle.clone()).expect("Load tweaks"); let button_handle = tweak.get_handle::("buttons_image_resting").unwrap(); diff --git a/src/tutorial.rs b/src/tutorial.rs index 474a911..02761bf 100644 --- a/src/tutorial.rs +++ b/src/tutorial.rs @@ -90,7 +90,7 @@ fn initialize_tutorial( ) { let tweak = tweaks.get(tweaks_file.handle.clone()).expect("Load tweaks"); - info!("Initializing tutorial entities"); + debug!("Initializing tutorial entities"); let background_hex = tweak.get::("tutorial_rgba_background").unwrap(); let text_visible_hex = tweak.get::("tutorial_rgba_visible").unwrap(); @@ -552,7 +552,7 @@ fn activate_tutorial_step( state: Res>, mut query: Query<(&mut Visibility, &TutorialState), Without>, ) { - info!("Activating tutorial step {:?}", state.get()); + debug!("Activating tutorial step {:?}", state.get()); // Iterate over all entities with TutorialState components query.iter_mut().for_each(|(mut v, s)| { @@ -577,7 +577,7 @@ fn start_tutorial_on_play( mut commands: Commands, ) { if query.iter().len() == 0 && *state.get() == TutorialState::None && board.current_epoch() <= 1 { - info!("Starting intro tutorial!"); + debug!("Starting intro tutorial!"); next_state.set(TutorialState::Intro); commands.insert_resource(TutorialStarted); }