diff --git a/build.rs b/build.rs index ac7d01f..28abec9 100644 --- a/build.rs +++ b/build.rs @@ -25,6 +25,13 @@ fn write_version_file() { .stdout, ) .expect("Read stdout from git sha command"); + let git_sha = git_sha.trim(); + + // Determine the build type based on cfg flags + #[cfg(debug_assertions)] + let build_type = "debug"; + #[cfg(not(debug_assertions))] + let build_type = "release"; // If the workspace is dirty or clean let clean = Command::new("git") @@ -37,9 +44,9 @@ fn write_version_file() { let mut file = File::create("VERSION").expect("Create VERSION file"); if clean { - write!(file, "0.0.0-{now}+{}", git_sha.trim()).expect("Write version to VERSION file"); + write!(file, "0.0.0-{now}+{git_sha}-{build_type}").expect("Write version to VERSION file"); } else { - write!(file, "0.0.0-{now}+{}-dirty", git_sha.trim()) + write!(file, "0.0.0-{now}+{git_sha}-{build_type}-dirty") .expect("Write version to VERSION file"); } } diff --git a/src/bin/trees/main.rs b/src/bin/trees/main.rs index 0dd23a1..fbcd6aa 100644 --- a/src/bin/trees/main.rs +++ b/src/bin/trees/main.rs @@ -48,7 +48,9 @@ fn main() { .run_if(on_event::>), spawn_debug_buttons.run_if(on_event::>), handle_plant_tree.run_if(on_event::), - assign_monologue_to_tree.run_if(on_event::).after(handle_plant_tree), + assign_monologue_to_tree + .run_if(on_event::) + .after(handle_plant_tree), dialog_engine.run_if(on_event::), auto_scroll.run_if(any_component_added::), dialog_box_visibility.run_if(state_changed::), @@ -707,11 +709,8 @@ fn handle_plant_tree( .observe(delete_tree) .observe(drag_tree); - match assignment { - Some(handle) => { - assignments.write(AssignMonologue(handle.clone())); - } - None => () + if let Some(handle) = assignment { + assignments.write(AssignMonologue(handle.clone())); } }); } @@ -862,10 +861,7 @@ fn assign_monologue_event( } /// On startup, plant a forest (add a few trees to the game) -fn plant_forest( - monos: Res>, - mut e_trees: EventWriter, -) { +fn plant_forest(monos: Res>, mut e_trees: EventWriter) { let mut i = 10; for id in monos.ids() { debug!("Planting tree with monologue {:?}", id); @@ -874,7 +870,7 @@ fn plant_forest( } else if i > 0 { e_trees.write(PlantTree(None)); } else { - break + break; } i -= 1; } diff --git a/src/debug.rs b/src/debug.rs index 494e28b..3fdceaa 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -83,21 +83,20 @@ fn init_debug_ui(mut commands: Commands) { }, )); - commands.spawn(( - DebuggingState::On, - Name::new("Notice"), - children![( - Text::new(""), - SyncResource::::default(), - )], - GlobalZIndex(i32::MAX - 1), - Node { - max_width: Val::Percent(50.0), - align_self: AlignSelf::End, - justify_self: JustifySelf::Start, - ..default() - }, - )).observe(close_on_click); + commands + .spawn(( + DebuggingState::On, + Name::new("Notice"), + children![(Text::new(""), SyncResource::::default(),)], + GlobalZIndex(i32::MAX - 1), + Node { + max_width: Val::Percent(50.0), + align_self: AlignSelf::End, + justify_self: JustifySelf::Start, + ..default() + }, + )) + .observe(close_on_click); // "Turn on Debugging" button commands @@ -391,10 +390,7 @@ fn toggle_debug( }); } -fn close_on_click( - trigger: Trigger>, - mut query: Query<&mut Visibility>, -) { +fn close_on_click(trigger: Trigger>, mut query: Query<&mut Visibility>) { if let Ok(mut v) = query.get_mut(trigger.target()) { *v = Visibility::Hidden; }