From 3081381bbde2a0de19ab563d5cc053bc6ab09c38 Mon Sep 17 00:00:00 2001 From: Rodrigo Navarro Date: Fri, 3 Nov 2023 12:31:46 -0300 Subject: [PATCH] Lint and format fixes. --- src/boundary.rs | 5 +---- src/collision.rs | 8 +++++--- src/expiration.rs | 3 ++- src/flickering.rs | 5 +---- src/main.rs | 23 ++++++++++++++++------- src/physics.rs | 4 ++-- 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/boundary.rs b/src/boundary.rs index a336da6..e647219 100644 --- a/src/boundary.rs +++ b/src/boundary.rs @@ -4,10 +4,7 @@ pub struct BoundaryPlugin; impl Plugin for BoundaryPlugin { fn build(&self, app: &mut App) { - app.add_systems( - PostUpdate, - (boundary_remove_system, boundary_wrap_system) - ); + app.add_systems(PostUpdate, (boundary_remove_system, boundary_wrap_system)); } } diff --git a/src/collision.rs b/src/collision.rs index c7fb44c..c4d760a 100644 --- a/src/collision.rs +++ b/src/collision.rs @@ -1,6 +1,6 @@ use std::marker::PhantomData; -use bevy::{prelude::*, ecs::schedule::ScheduleLabel}; +use bevy::{ecs::schedule::ScheduleLabel, prelude::*}; use crate::boundary::Bounding; @@ -18,8 +18,10 @@ impl CollisionPlugin Plugin for CollisionPlugin { fn build(&self, app: &mut App) { - app.add_event::>() - .add_systems(Update, collision_system::.in_set(CollisionSystemLabel)); + app.add_event::>().add_systems( + Update, + collision_system::.in_set(CollisionSystemLabel), + ); } } diff --git a/src/expiration.rs b/src/expiration.rs index e7bf6f9..44f2bc0 100644 --- a/src/expiration.rs +++ b/src/expiration.rs @@ -6,7 +6,8 @@ pub struct ExpirationPlugin; impl Plugin for ExpirationPlugin { fn build(&self, app: &mut App) { - app.add_systems(PostUpdate, expiration_system); } + app.add_systems(PostUpdate, expiration_system); + } } #[derive(Debug, Component, Deref, DerefMut)] diff --git a/src/flickering.rs b/src/flickering.rs index 1219504..82b9a6d 100644 --- a/src/flickering.rs +++ b/src/flickering.rs @@ -6,10 +6,7 @@ pub struct FlickPlugin; impl Plugin for FlickPlugin { fn build(&self, app: &mut App) { - app.add_systems( - PostUpdate, - (flick_removed_system, flick_system) - ); + app.add_systems(PostUpdate, (flick_removed_system, flick_system)); } } diff --git a/src/main.rs b/src/main.rs index 48c280d..ab23d2f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,9 +2,13 @@ use std::{f32::consts::PI, ops::Range, time::Duration}; -use bevy::{prelude::*, time::common_conditions::on_timer, utils::HashSet, window::PrimaryWindow}; -use bevy::ecs::{event::{Event}}; -use bevy::ecs::schedule::ScheduleLabel; +use bevy::{ + ecs::{event::Event, schedule::ScheduleLabel}, + prelude::*, + time::common_conditions::on_timer, + utils::HashSet, + window::PrimaryWindow, +}; use bevy_prototype_lyon::{ entity::ShapeBundle, prelude::{ @@ -71,9 +75,15 @@ fn main() { ) .add_systems(Update, weapon_system.after(InputLabel)) .add_systems(Update, thrust_system.after(InputLabel)) - .add_systems(Update, asteroid_spawn_system.run_if(on_timer(Duration::from_secs_f32(0.5)))) + .add_systems( + Update, + asteroid_spawn_system.run_if(on_timer(Duration::from_secs_f32(0.5))), + ) .add_systems(Update, asteroid_generation_system) - .add_systems(Update, ufo_spawn_system.run_if(on_timer(Duration::from_secs_f32(1.0)))) + .add_systems( + Update, + ufo_spawn_system.run_if(on_timer(Duration::from_secs_f32(1.0))), + ) .add_systems(Update, explosion_system) .add_systems(Update, ship_state_system.before(CollisionSystemLabel)) .add_systems(Update, ufo_state_system.before(CollisionSystemLabel)) @@ -220,7 +230,6 @@ struct AsteroidSpawnEvent(Vec2, Bounding); #[derive(Bundle)] struct ExplosionBundle { - //#[bundle] shape: ShapeBundle, fill: Fill, explosion: Explosion, @@ -240,7 +249,7 @@ impl Default for ExplosionBundle { ..Default::default() }, fill: Fill::color(Color::WHITE), - explosion: Explosion::default(), + explosion: Explosion, velocity: Velocity::default(), damping: Damping::from(0.97), expiration: Expiration::new(Duration::from_secs(1)), diff --git a/src/physics.rs b/src/physics.rs index 48ec4c9..dd6758e 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use bevy::{prelude::*, time::common_conditions::on_fixed_timer, ecs::schedule::ScheduleLabel}; +use bevy::{ecs::schedule::ScheduleLabel, prelude::*, time::common_conditions::on_fixed_timer}; use derive_more::From; pub struct PhysicsPlugin { @@ -35,7 +35,7 @@ impl Plugin for PhysicsPlugin { movement_system, ) .distributive_run_if(on_fixed_timer(Duration::from_secs_f32(self.time_step))) - .in_set(PhysicsSystemLabel) + .in_set(PhysicsSystemLabel), ); } }