M crates/unified/src/client/net.rs => crates/unified/src/client/net.rs +2 -2
@@ 5,8 5,8 @@ use aeronet_transport::TransportConfig;
use bevy::prelude::*;
pub fn set_config(mut q: Query<&mut TransportConfig, Added<TransportConfig>>) {
- for mut q in q.iter_mut() {
- q.max_memory_usage = 8388608; // 8 MiB
+ for mut q in &mut q {
+ q.max_memory_usage = 8_388_608; // 8 MiB
}
}
M crates/unified/src/client/planet/incoming_planets.rs => crates/unified/src/client/planet/incoming_planets.rs +8 -14
@@ 10,18 10,15 @@ fn handle_incoming_planets(
mut commands: Commands,
new_planets: Query<(Entity, &Planet), Added<Planet>>,
asset_server: Res<AssetServer>,
- mut meshes: ResMut<Assets<Mesh>>,
- mut materials: ResMut<Assets<ColorMaterial>>
+ meshes: ResMut<Assets<Mesh>>,
+ materials: ResMut<Assets<ColorMaterial>>
) {
for (new_entity, new_planet) in new_planets.iter() {
let mut sprite = Sprite::from_image(asset_server.load(&new_planet.sprite));
sprite.custom_size = Some(Vec2::new(new_planet.radius * 2.0, new_planet.radius * 2.0));
- match new_planet.special_sprite_properties {
- Some(SpecialSpriteProperties::ForceColor(c)) => {
- sprite.color = c;
- },
- _ => {}
+ if let Some(SpecialSpriteProperties::ForceColor(c)) = new_planet.special_sprite_properties {
+ sprite.color = c;
}
let mut commands = commands
@@ 37,8 34,8 @@ fn handle_updated_planets(
mut commands: Commands,
updated_planets: Query<(Entity, &Planet), Changed<Planet>>,
asset_server: Res<AssetServer>,
- mut meshes: ResMut<Assets<Mesh>>,
- mut materials: ResMut<Assets<ColorMaterial>>
+ meshes: ResMut<Assets<Mesh>>,
+ materials: ResMut<Assets<ColorMaterial>>
) {
for (updated_entity, updated_planet) in updated_planets.iter() {
let mut sprite = Sprite::from_image(asset_server.load(&updated_planet.sprite));
@@ 47,11 44,8 @@ fn handle_updated_planets(
updated_planet.radius * 2.0,
));
- match updated_planet.special_sprite_properties {
- Some(SpecialSpriteProperties::ForceColor(c)) => {
- sprite.color = c;
- },
- _ => {}
+ if let Some(SpecialSpriteProperties::ForceColor(c)) = updated_planet.special_sprite_properties {
+ sprite.color = c;
}
let mut commands = commands.entity(updated_entity);
M crates/unified/src/client/planet/indicators.rs => crates/unified/src/client/planet/indicators.rs +1 -1
@@ 2,7 2,7 @@ use bevy::prelude::*;
use bevy::window::PrimaryWindow;
use crate::client::Me;
use crate::config::planet::Planet;
-use crate::ecs::{MainCamera, StarfieldBack, StarfieldFront, StarfieldMid};
+use crate::ecs::MainCamera;
pub fn indicators_plugin(app: &mut App) {
app.add_systems(PreUpdate, (add_indicators, update_indicators))
M crates/unified/src/lib.rs => crates/unified/src/lib.rs +1 -2
@@ 24,5 24,4 @@ pub mod ecs;
pub mod server;
#[cfg(all(not(target_arch = "wasm32"), feature = "native"))]
pub mod server_plugins;
-pub mod shared_plugins;
-pub mod particle;
+pub mod shared_plugins;<
\ No newline at end of file
M crates/unified/src/particles.rs => crates/unified/src/particles.rs +4 -5
@@ 1,9 1,8 @@
-use bevy::color::{Color, ColorCurve, LinearRgba};
+use bevy::color::LinearRgba;
use bevy::math::cubic_splines::LinearSpline;
-use bevy::math::{Vec2, VectorSpace};
+use bevy::math::Vec2;
use rand::Rng;
use serde::{Deserialize, Serialize};
-use serde::de::DeserializeOwned;
#[derive(Deserialize, Serialize)]
pub struct ParticleEffect {
@@ 38,14 37,14 @@ pub struct ParticleEffect {
pub struct ScaleSpline(Vec<f32>);
impl From<ScaleSpline> for LinearSpline<f32> {
fn from(value: ScaleSpline) -> Self {
- Self::new(&value.0)
+ Self::new(value.0)
}
}
#[derive(Deserialize, Serialize)]
pub struct ColorSpline(Vec<LinearRgba>);
impl From<ColorSpline> for LinearSpline<LinearRgba> {
fn from(value: ColorSpline) -> Self {
- Self::new(&value.0)
+ Self::new(value.0)
}
}
M crates/unified/src/server/earth_parts.rs => crates/unified/src/server/earth_parts.rs +3 -4
@@ 1,13 1,12 @@
-use std::time::Duration;
use bevy::app::App;
use bevy::math::Vec2;
use bevy::prelude::{Commands, Query, Res, Transform};
-use bevy::time::{Real, Time};
-use bevy_rapier2d::dynamics::{AdditionalMassProperties, ExternalForce, MassProperties};
+use bevy::time::Time;
+use bevy_rapier2d::dynamics::{AdditionalMassProperties, MassProperties};
use bevy_rapier2d::geometry::Collider;
use bevy_replicon::prelude::Replicated;
use crate::config::planet::Planet;
-use crate::ecs::{Part, PartBundle, Player, PlayerThrust};
+use crate::ecs::{Part, PartBundle};
use crate::server::world_config::WorldConfigResource;
use bevy::prelude::*;
M crates/unified/src/server/mod.rs => crates/unified/src/server/mod.rs +1 -1
@@ 16,7 16,7 @@ use aeronet_websocket::server::WebSocketServer;
use bevy::prelude::*;
use bevy_replicon::prelude::Replicated;
use std::net::SocketAddr;
-use crate::server::earth_parts::{spawn_parts_on_earth, spawn_parts_plugin};
+use crate::server::earth_parts::spawn_parts_plugin;
pub struct ServerPlugin {
pub bind: SocketAddr,
M crates/unified/src/server/player.rs => crates/unified/src/server/player.rs +1 -1
@@ 38,7 38,7 @@ fn handle_new_players(
let (spawn_planet_pos, spawn_planet) = planets
.iter()
.find(|p| p.1.name == wc.hearty.spawn_at)
- .expect(format!("spawn planet {} is missing? (check that the planet is named exactly '{}')", wc.hearty.spawn_at, wc.hearty.spawn_at).as_str());
+ .unwrap_or_else(|| panic!("spawn planet {} is missing? (check that the planet is named exactly '{}')", wc.hearty.spawn_at, wc.hearty.spawn_at));
let angle = rand::random::<f32>() * std::f32::consts::TAU;
let offset = spawn_planet.radius + 150.0;
let mut new_transform =