From 13a0b543643523c6d80e0e43b286222ed5fc0a3e Mon Sep 17 00:00:00 2001 From: Elias Stepanik <40958815+eliasstepanik@users.noreply.github.com> Date: Fri, 13 Jun 2025 01:50:28 +0200 Subject: [PATCH] Update for Bevy 0.16 --- client/src/app.rs | 2 +- client/src/main.rs | 2 +- client/src/plugins/big_space/big_space_plugin.rs | 14 +++++++------- .../environment/systems/environment_system.rs | 14 +++++++------- .../plugins/environment/systems/planet_system.rs | 2 +- .../environment/systems/voxels/render_chunks.rs | 2 +- client/src/plugins/input/input_plugin.rs | 3 ++- client/src/plugins/ui/systems/ui_system.rs | 4 ++-- 8 files changed, 22 insertions(+), 21 deletions(-) diff --git a/client/src/app.rs b/client/src/app.rs index 958713e..b72c41e 100644 --- a/client/src/app.rs +++ b/client/src/app.rs @@ -10,7 +10,7 @@ impl Plugin for AppPlugin { app.add_plugins(crate::plugins::environment::environment_plugin::EnvironmentPlugin); //app.add_plugins(crate::plugins::network::network_plugin::NetworkPlugin); app.add_plugins(crate::plugins::input::input_plugin::InputPlugin); - app.add_plugins(WireframePlugin); + app.add_plugins(WireframePlugin::default()); app.add_systems(Update, (debug_gizmos)); app.register_type::>>(); diff --git a/client/src/main.rs b/client/src/main.rs index 8b1b77c..23d92c9 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -13,7 +13,7 @@ use bevy::render::RenderPlugin; use bevy::DefaultPlugins; use bevy::input::gamepad::AxisSettingsError::DeadZoneUpperBoundGreaterThanLiveZoneUpperBound; use bevy::window::PresentMode; -use big_space::plugin::BigSpacePlugin; +use big_space::plugin::BigSpaceDefaultPlugins; use toml; use crate::config::Config; use crate::plugins::big_space::big_space_plugin::BigSpaceIntegrationPlugin; diff --git a/client/src/plugins/big_space/big_space_plugin.rs b/client/src/plugins/big_space/big_space_plugin.rs index 35cf465..0674030 100644 --- a/client/src/plugins/big_space/big_space_plugin.rs +++ b/client/src/plugins/big_space/big_space_plugin.rs @@ -16,7 +16,7 @@ pub struct RootGrid(pub Entity); impl Plugin for BigSpaceIntegrationPlugin { fn build(&self, app: &mut App) { - app.add_plugins(BigSpacePlugin::::default()); + app.add_plugins(BigSpaceDefaultPlugins); app.add_systems(PreStartup, (spawn_root, cache_root.after(spawn_root))); app.add_systems(PostStartup, (fix_invalid_children)); @@ -27,7 +27,7 @@ impl Plugin for BigSpaceIntegrationPlugin { // 1) build the Big-Space root fn spawn_root(mut commands: Commands) { - commands.spawn_big_space_default::(|_| {}); + commands.spawn_big_space_default(|_| {}); } // 2) cache the root entity for later use @@ -44,10 +44,10 @@ fn cache_root( fn fix_invalid_children( mut commands: Commands, - bad: Query, Without>, With)>, + bad: Query, Without, With)>, ) { for e in &bad { - commands.entity(e).insert(GridCell::::ZERO); + commands.entity(e).insert(GridCell::ZERO); } } @@ -63,11 +63,11 @@ pub fn move_by( -pub fn teleport_to( +pub fn teleport_to( e: Entity, target: DVec3, - grids: Grids<'_, '_, P>, - mut q: Query<(&ChildOf, &mut GridCell

, &mut Transform)>, + grids: Grids<'_, '_>, + mut q: Query<(&ChildOf, &mut GridCell, &mut Transform)>, ) { let (child_of, mut cell, mut tf) = q.get_mut(e).unwrap(); let grid = grids.parent_grid(child_of.parent()).unwrap(); diff --git a/client/src/plugins/environment/systems/environment_system.rs b/client/src/plugins/environment/systems/environment_system.rs index b5b12c1..6606a6b 100644 --- a/client/src/plugins/environment/systems/environment_system.rs +++ b/client/src/plugins/environment/systems/environment_system.rs @@ -21,21 +21,21 @@ pub(crate) fn setup( ..default() }); - // light (unchanged) + // light commands.entity(root.0).with_children(|p| { - p.spawn(DirectionalLightBundle { - transform: Transform::from_rotation(Quat::from_euler( + p.spawn(( + Transform::from_rotation(Quat::from_euler( EulerRot::XYZ, -std::f32::consts::FRAC_PI_4, 0.0, 0.0, )), - directional_light: DirectionalLight { + GlobalTransform::default(), + DirectionalLight { shadows_enabled: true, ..default() }, - ..default() - }); + )); }); /*// ---------- spawn spheres from football-size up to Earth-size ---------- @@ -59,7 +59,7 @@ pub(crate) fn setup( parent.spawn(( // spatial requirements for big_space - GridCell::::ZERO, + GridCell::ZERO, Transform::from_scale(scale_v3).with_translation(pos), GlobalTransform::default(), // rendering diff --git a/client/src/plugins/environment/systems/planet_system.rs b/client/src/plugins/environment/systems/planet_system.rs index cbd490c..fc8753c 100644 --- a/client/src/plugins/environment/systems/planet_system.rs +++ b/client/src/plugins/environment/systems/planet_system.rs @@ -36,7 +36,7 @@ pub fn setup( Name::new("Planet"), Mesh3d(sphere_mesh.clone()), MeshMaterial3d(material_handle), - GridCell::::ZERO, + GridCell::ZERO, Transform::default(), PlanetMaker, Wireframe, diff --git a/client/src/plugins/environment/systems/voxels/render_chunks.rs b/client/src/plugins/environment/systems/voxels/render_chunks.rs index 36d1eac..eb74e1d 100644 --- a/client/src/plugins/environment/systems/voxels/render_chunks.rs +++ b/client/src/plugins/environment/systems/voxels/render_chunks.rs @@ -109,7 +109,7 @@ pub fn rebuild_dirty_chunks( Mesh3d::from(mesh_h.clone()), MeshMaterial3d(mat_h.clone()), Transform::default(), - GridCell::::ZERO, + GridCell::ZERO, Chunk { key, voxels: Vec::new(), dirty: false }, ChunkLod(lod), /*Wireframe,*/ diff --git a/client/src/plugins/input/input_plugin.rs b/client/src/plugins/input/input_plugin.rs index b64cc76..b5bda72 100644 --- a/client/src/plugins/input/input_plugin.rs +++ b/client/src/plugins/input/input_plugin.rs @@ -1,6 +1,7 @@ use bevy::app::{App, Plugin, PreUpdate, Startup}; -use bevy::prelude::{IntoSystemConfigs, Update}; +use bevy::ecs::schedule::IntoScheduleConfigs; +use bevy::prelude::Update; pub struct InputPlugin; impl Plugin for InputPlugin { diff --git a/client/src/plugins/ui/systems/ui_system.rs b/client/src/plugins/ui/systems/ui_system.rs index 95e8944..4c949a9 100644 --- a/client/src/plugins/ui/systems/ui_system.rs +++ b/client/src/plugins/ui/systems/ui_system.rs @@ -43,9 +43,9 @@ pub fn setup(mut commands: Commands, asset_server: Res) { /// - current chunk coordinate pub fn update( - grids: Grids<'_, '_, i64>, // helper from big_space + grids: Grids<'_, '_>, // helper from big_space // we need the entity id, the cell & the local transform - camera_q: Query<(Entity, &GridCell, &Transform, &CameraController)>, + camera_q: Query<(Entity, &GridCell, &Transform, &CameraController)>, mut ui_q: Query<&mut Text, With>, ) { let Ok((cam_ent, cell, tf, ctrl)) = camera_q.get_single() else { return };