From 3fda3e4fdab15e5a633d1fc24dece34e16ba0743 Mon Sep 17 00:00:00 2001 From: core Date: Fri, 4 Jul 2025 14:24:09 -0400 Subject: [PATCH] chore(fmt): format --- .../unified/src/client/incoming_particles.rs | 34 +++++++++++++++---- crates/unified/src/client/mod.rs | 4 +-- crates/unified/src/ecs.rs | 4 +-- crates/unified/src/lib.rs | 2 +- crates/unified/src/server/player.rs | 26 +++++++++++--- 5 files changed, 54 insertions(+), 16 deletions(-) diff --git a/crates/unified/src/client/incoming_particles.rs b/crates/unified/src/client/incoming_particles.rs index cf9633cd1a11ab2204003ad1076265955d58d3af..4ff05e7a69d7710f2494773fe09dd65490eb3060 100644 --- a/crates/unified/src/client/incoming_particles.rs +++ b/crates/unified/src/client/incoming_particles.rs @@ -1,15 +1,23 @@ +use crate::ecs::Particles; use bevy::prelude::*; -use bevy_enoki::{ParticleEffectHandle, ParticleSpawner}; use bevy_enoki::prelude::ParticleSpawnerState; -use crate::ecs::Particles; +use bevy_enoki::{ParticleEffectHandle, ParticleSpawner}; pub fn replicated_particles_plugin(app: &mut App) { - app.add_systems(PreUpdate, (replicate_new_particles, replicate_updated_particles)); + app.add_systems( + PreUpdate, + (replicate_new_particles, replicate_updated_particles), + ); } -fn replicate_new_particles(q: Query<(Entity, &Particles), Added>, assets: Res, mut commands: Commands) { +fn replicate_new_particles( + q: Query<(Entity, &Particles), Added>, + assets: Res, + mut commands: Commands, +) { for (entity, p) in q.iter() { - commands.entity(entity) + commands + .entity(entity) .insert(ParticleSpawner::default()) .insert(ParticleEffectHandle(assets.load(&p.effect))) .insert(ParticleSpawnerState { @@ -19,9 +27,21 @@ fn replicate_new_particles(q: Query<(Entity, &Particles), Added>, ass info!("replicate_new_particles {:?}", p); } } -fn replicate_updated_particles(mut q: Query<(Entity, &mut ParticleEffectHandle, &mut ParticleSpawnerState, &Particles), Changed>, assets: Res, mut commands: Commands ) { +fn replicate_updated_particles( + mut q: Query< + ( + Entity, + &mut ParticleEffectHandle, + &mut ParticleSpawnerState, + &Particles, + ), + Changed, + >, + assets: Res, + mut commands: Commands, +) { for (_entity, mut handle, mut state, p) in q.iter_mut() { *handle = ParticleEffectHandle(assets.load(&p.effect)); state.active = p.active; } -} \ No newline at end of file +} diff --git a/crates/unified/src/client/mod.rs b/crates/unified/src/client/mod.rs index 0a998f75ef7a19fff5c81670ba2a5e80240522e3..e151370c6e0b684d8b2cff004bf880a56a657054 100644 --- a/crates/unified/src/client/mod.rs +++ b/crates/unified/src/client/mod.rs @@ -1,12 +1,13 @@ mod colors; +mod incoming_particles; mod incoming_parts; mod incoming_planets; mod key_input; mod net; mod starfield; mod ui; -mod incoming_particles; +use crate::client::incoming_particles::replicated_particles_plugin; use crate::client::incoming_parts::incoming_parts_plugin; use crate::client::incoming_planets::incoming_planets_plugin; use crate::client::key_input::key_input_plugin; @@ -18,7 +19,6 @@ use bevy::core_pipeline::fxaa::Fxaa; use bevy::prelude::*; use bevy::window::PrimaryWindow; use bevy_replicon::shared::server_entity_map::ServerEntityMap; -use crate::client::incoming_particles::replicated_particles_plugin; pub struct ClientPlugin { pub server: String, diff --git a/crates/unified/src/ecs.rs b/crates/unified/src/ecs.rs index 58ab04b346990978abbba21ec97bc51b5fd86576..f4e06c112f40f44b97e3696e58421aa4be594375 100644 --- a/crates/unified/src/ecs.rs +++ b/crates/unified/src/ecs.rs @@ -65,5 +65,5 @@ pub struct PlayerThrust { #[derive(Component, Serialize, Deserialize, Debug)] pub struct Particles { pub effect: String, - pub active: bool -} \ No newline at end of file + pub active: bool, +} diff --git a/crates/unified/src/lib.rs b/crates/unified/src/lib.rs index 3d048c37eccdb0a7c6f6c197ad64c15be8810ab3..adc27f0d3f542cdd80bcadb0f253c843eee079ab 100644 --- a/crates/unified/src/lib.rs +++ b/crates/unified/src/lib.rs @@ -23,4 +23,4 @@ pub mod ecs; pub mod server; #[cfg(all(not(target_arch = "wasm32"), feature = "native"))] pub mod server_plugins; -pub mod shared_plugins; \ No newline at end of file +pub mod shared_plugins; diff --git a/crates/unified/src/server/player.rs b/crates/unified/src/server/player.rs index a643bf4b21e90fc5d22e3a9437ed27ae3ab165f3..fb390bb626dcc80fa7c4c86b2ca57045d52ab357 100644 --- a/crates/unified/src/server/player.rs +++ b/crates/unified/src/server/player.rs @@ -83,7 +83,12 @@ fn handle_new_players( effect: "particles/ship_thruster.particle.ron".to_string(), active: true }, - Transform::from_xyz(-wc.part.default_width / 2.0 + 5.0, -wc.part.default_height / 2.0, 0.0).with_rotation(Quat::from_rotation_z(180.0f32.to_radians())), + Transform::from_xyz( + -wc.part.default_width / 2.0 + 5.0, + -wc.part.default_height / 2.0, + 0.0 + ) + .with_rotation(Quat::from_rotation_z(180.0f32.to_radians())), Replicated ), // bottom right @@ -92,7 +97,12 @@ fn handle_new_players( effect: "particles/ship_thruster.particle.ron".to_string(), active: true }, - Transform::from_xyz(wc.part.default_width / 2.0 - 5.0, -wc.part.default_height / 2.0, 0.0).with_rotation(Quat::from_rotation_z(180.0f32.to_radians())), + Transform::from_xyz( + wc.part.default_width / 2.0 - 5.0, + -wc.part.default_height / 2.0, + 0.0 + ) + .with_rotation(Quat::from_rotation_z(180.0f32.to_radians())), Replicated ), // top left @@ -101,7 +111,11 @@ fn handle_new_players( effect: "particles/ship_thruster.particle.ron".to_string(), active: true }, - Transform::from_xyz(-wc.part.default_width / 2.0 + 5.0, wc.part.default_height / 2.0, 0.0), + Transform::from_xyz( + -wc.part.default_width / 2.0 + 5.0, + wc.part.default_height / 2.0, + 0.0 + ), Replicated ), // top right @@ -110,7 +124,11 @@ fn handle_new_players( effect: "particles/ship_thruster.particle.ron".to_string(), active: true }, - Transform::from_xyz(wc.part.default_width / 2.0 - 5.0, wc.part.default_height / 2.0, 0.0), + Transform::from_xyz( + wc.part.default_width / 2.0 - 5.0, + wc.part.default_height / 2.0, + 0.0 + ), Replicated ), ]);