diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-07-09 19:11:29 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-09 19:11:29 -0500 |
| commit | d1afd02aa84e7b4450c1607277f078eb2a0f1bf3 (patch) | |
| tree | efea9bb7ef7f2064f7c963fd88f394fecec6231b /azalea/src/pathfinder | |
| parent | ea8a8fccb6eb39c97f6cb69e11db5f7d0886172e (diff) | |
| download | azalea-drasl-d1afd02aa84e7b4450c1607277f078eb2a0f1bf3.tar.xz | |
Update to Bevy 0.11 (#94)
* update to bevy 0.11
* clippy
---------
Co-authored-by: mat <git@matdoes.dev>
Diffstat (limited to 'azalea/src/pathfinder')
| -rw-r--r-- | azalea/src/pathfinder/mod.rs | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index b7ed222d..9547d263 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -5,13 +5,12 @@ use crate::bot::{JumpEvent, LookAtEvent}; use crate::pathfinder::astar::a_star; use crate::{SprintDirection, WalkDirection}; -use crate::app::{App, CoreSchedule, IntoSystemAppConfig, Plugin}; +use crate::app::{App, Plugin}; use crate::ecs::{ component::Component, entity::Entity, event::{EventReader, EventWriter}, query::{With, Without}, - schedule::IntoSystemConfig, system::{Commands, Query, Res}, }; use astar::Edge; @@ -24,6 +23,9 @@ use azalea_world::{ entity::{Physics, Position, WorldName}, InstanceContainer, }; +use bevy_app::{FixedUpdate, Update}; +use bevy_ecs::prelude::Event; +use bevy_ecs::schedule::IntoSystemConfigs; use bevy_tasks::{AsyncComputeTaskPool, Task}; use futures_lite::future; use log::{debug, error}; @@ -36,17 +38,20 @@ impl Plugin for PathfinderPlugin { fn build(&self, app: &mut App) { app.add_event::<GotoEvent>() .add_event::<PathFoundEvent>() - .add_system( - // Adding `.in_schedule(CoreSchedule::FixedUpdate)` makes a system run every - // Minecraft tick (every 50 milliseconds). - tick_execute_path - .in_schedule(CoreSchedule::FixedUpdate) - .before(PhysicsSet), + .add_systems( + FixedUpdate, + // putting systems in the FixedUpdate schedule makes them run every Minecraft tick + // (every 50 milliseconds). + tick_execute_path.before(PhysicsSet), ) - .add_system(goto_listener) - .add_system(add_default_pathfinder) - .add_system(handle_tasks.before(path_found_listener)) - .add_system(path_found_listener); + .add_systems( + Update, + ( + goto_listener, + add_default_pathfinder, + (handle_tasks, path_found_listener).chain(), + ), + ); } } @@ -84,10 +89,12 @@ impl PathfinderClientExt for azalea_client::Client { }); } } +#[derive(Event)] pub struct GotoEvent { pub entity: Entity, pub goal: Arc<dyn Goal + Send + Sync>, } +#[derive(Event)] pub struct PathFoundEvent { pub entity: Entity, pub path: VecDeque<Node>, |
