From ba5d885415445bf0f8a3e0c3e63c4ba0818180fd Mon Sep 17 00:00:00 2001 From: Isaac Turci <78173025+Zac8668@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:25:44 -0300 Subject: [PATCH] Fixed Update on simulation (#49) --- src/actors.rs | 2 +- src/animation.rs | 2 +- src/chunk_manager.rs | 3 ++- src/particles.rs | 2 +- src/player.rs | 14 ++++++++++---- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/actors.rs b/src/actors.rs index 5c89fc3..1b21847 100644 --- a/src/actors.rs +++ b/src/actors.rs @@ -244,7 +244,7 @@ pub struct ActorsPlugin; impl Plugin for ActorsPlugin { fn build(&self, app: &mut App) { app.add_systems( - Update, + FixedUpdate, ( add_actors .before(chunk_manager_update) diff --git a/src/animation.rs b/src/animation.rs index 59b2910..7856e0e 100644 --- a/src/animation.rs +++ b/src/animation.rs @@ -34,6 +34,6 @@ fn animate_sprite( pub struct AnimationPlugin; impl Plugin for AnimationPlugin { fn build(&self, app: &mut App) { - app.add_systems(Update, animate_sprite.after(update_player_sprite)); + app.add_systems(FixedUpdate, animate_sprite.after(update_player_sprite)); } } diff --git a/src/chunk_manager.rs b/src/chunk_manager.rs index e97c9ca..a7e6151 100644 --- a/src/chunk_manager.rs +++ b/src/chunk_manager.rs @@ -674,7 +674,8 @@ pub struct ChunkManagerPlugin; impl Plugin for ChunkManagerPlugin { fn build(&self, app: &mut App) { app.add_systems(Startup, manager_setup) - .add_systems(Update, (chunk_manager_update, update_manager_pos)) + .add_systems(FixedUpdate, chunk_manager_update) + .add_systems(Update, update_manager_pos) .init_resource::() .init_resource::(); diff --git a/src/particles.rs b/src/particles.rs index b08bef7..b5eb5e1 100644 --- a/src/particles.rs +++ b/src/particles.rs @@ -239,7 +239,7 @@ pub struct ParticlesPlugin; impl Plugin for ParticlesPlugin { fn build(&self, app: &mut App) { app.add_systems( - Update, + FixedUpdate, ( hydrate_particles.before(update_particles), update_particles.after(chunk_manager_update), diff --git a/src/player.rs b/src/player.rs index df23b84..dbc9981 100644 --- a/src/player.rs +++ b/src/player.rs @@ -352,9 +352,15 @@ pub struct SavingTask(pub Option>); pub struct PlayerPlugin; impl Plugin for PlayerPlugin { fn build(&self, app: &mut App) { - app.add_systems(Update, (update_player.after(chunk_manager_update),)) - .add_systems(PostUpdate, (update_player_sprite, tool_system)) - .insert_resource(SavingTask::default()) - .add_systems(PostStartup, player_setup.after(manager_setup)); + app.add_systems( + FixedUpdate, + ( + update_player.after(chunk_manager_update), + update_player_sprite, + tool_system.after(chunk_manager_update), + ), + ) + .insert_resource(SavingTask::default()) + .add_systems(PostStartup, player_setup.after(manager_setup)); } }