Skip to content

Commit

Permalink
Lint and format fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
reu committed Nov 3, 2023
1 parent 9245fa5 commit 3081381
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 21 deletions.
5 changes: 1 addition & 4 deletions src/boundary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/collision.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::marker::PhantomData;

use bevy::{prelude::*, ecs::schedule::ScheduleLabel};
use bevy::{ecs::schedule::ScheduleLabel, prelude::*};

use crate::boundary::Bounding;

Expand All @@ -18,8 +18,10 @@ impl<Hittable: Component, Hurtable: Component> CollisionPlugin<Hittable, Hurtabl

impl<Hittable: Component, Hurtable: Component> Plugin for CollisionPlugin<Hittable, Hurtable> {
fn build(&self, app: &mut App) {
app.add_event::<HitEvent<Hittable, Hurtable>>()
.add_systems(Update, collision_system::<Hittable, Hurtable>.in_set(CollisionSystemLabel));
app.add_event::<HitEvent<Hittable, Hurtable>>().add_systems(
Update,
collision_system::<Hittable, Hurtable>.in_set(CollisionSystemLabel),
);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/expiration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
5 changes: 1 addition & 4 deletions src/flickering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
23 changes: 16 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -220,7 +230,6 @@ struct AsteroidSpawnEvent(Vec2, Bounding);

#[derive(Bundle)]
struct ExplosionBundle {
//#[bundle]
shape: ShapeBundle,
fill: Fill,
explosion: Explosion,
Expand All @@ -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)),
Expand Down
4 changes: 2 additions & 2 deletions src/physics.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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),
);
}
}
Expand Down

0 comments on commit 3081381

Please sign in to comment.