diff --git a/crates/behaviour/src/chase.rs b/crates/behaviour/src/chase.rs index e1aa8040..289179e9 100644 --- a/crates/behaviour/src/chase.rs +++ b/crates/behaviour/src/chase.rs @@ -1,6 +1,6 @@ use bevy::prelude::*; use de_core::{baseset::GameSet, gamestate::GameState, projection::ToFlat}; -use de_pathing::{PathQueryProps, PathTarget, UpdateEntityPath}; +use de_pathing::{PathQueryProps, PathTarget, UpdateEntityPathEvent}; pub(crate) struct ChasePlugin; @@ -127,7 +127,7 @@ fn handle_chase_events(mut commands: Commands, mut events: EventReader, + mut path_events: EventWriter, chasing: Query<( Entity, &Transform, @@ -153,7 +153,7 @@ fn chase( continue; } - path_events.send(UpdateEntityPath::new( + path_events.send(UpdateEntityPathEvent::new( entity, PathTarget::new( target_position, diff --git a/crates/construction/src/manufacturing.rs b/crates/construction/src/manufacturing.rs index 856a588c..adf5bac8 100644 --- a/crates/construction/src/manufacturing.rs +++ b/crates/construction/src/manufacturing.rs @@ -14,7 +14,7 @@ use de_core::{ }; use de_index::SpatialQuery; use de_objects::SolidObjects; -use de_pathing::{PathQueryProps, PathTarget, UpdateEntityPath}; +use de_pathing::{PathQueryProps, PathTarget, UpdateEntityPathEvent}; use de_signs::{ LineLocation, UpdateLineEndEvent, UpdateLineLocationEvent, UpdatePoleLocationEvent, }; @@ -426,7 +426,7 @@ fn deliver( mut commands: Commands, solids: SolidObjects, mut deliver_events: EventReader, - mut path_events: EventWriter, + mut path_events: EventWriter, factories: Query<(&Transform, &ObjectType, &Player, &DeliveryLocation)>, ) { for delivery in deliver_events.iter() { @@ -451,7 +451,7 @@ fn deliver( DespawnOnGameExit, )) .id(); - path_events.send(UpdateEntityPath::new( + path_events.send(UpdateEntityPathEvent::new( unit, PathTarget::new( delivery_location.0, diff --git a/crates/controller/src/commands/executor.rs b/crates/controller/src/commands/executor.rs index 4de9f680..6053abd6 100644 --- a/crates/controller/src/commands/executor.rs +++ b/crates/controller/src/commands/executor.rs @@ -3,7 +3,7 @@ use de_behaviour::ChaseTargetEvent; use de_combat::AttackEvent; use de_construction::{AssemblyLine, ChangeDeliveryLocationEvent}; use de_core::{baseset::GameSet, gamestate::GameState, objects::MovableSolid}; -use de_pathing::{PathQueryProps, PathTarget, UpdateEntityPath}; +use de_pathing::{PathQueryProps, PathTarget, UpdateEntityPathEvent}; use glam::Vec2; use crate::selection::Selected; @@ -89,13 +89,13 @@ type SelectedMovable = (With, With); fn send_selected_system( mut send_events: EventReader, selected: Query, - mut path_events: EventWriter, + mut path_events: EventWriter, mut chase_events: EventWriter, ) { if let Some(send) = send_events.iter().last() { for entity in selected.iter() { chase_events.send(ChaseTargetEvent::new(entity, None)); - path_events.send(UpdateEntityPath::new( + path_events.send(UpdateEntityPathEvent::new( entity, PathTarget::new(send.target(), PathQueryProps::exact(), false), )); diff --git a/crates/pathing/src/fplugin.rs b/crates/pathing/src/fplugin.rs index 3af45fce..91ed7649 100644 --- a/crates/pathing/src/fplugin.rs +++ b/crates/pathing/src/fplugin.rs @@ -41,7 +41,7 @@ pub struct FinderPlugin; impl Plugin for FinderPlugin { fn build(&self, app: &mut App) { - app.add_event::() + app.add_event::() .add_system(setup_loading.in_schedule(OnEnter(AppState::InGame))) .add_system(setup_playing.in_schedule(OnEnter(GameState::Playing))) .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) @@ -84,7 +84,7 @@ pub(crate) enum FinderSet { /// /// Paths found before the event was sent may no longer be optimal or may lead /// through non-accessible area. -pub(crate) struct PathFinderUpdated; +pub(crate) struct PathFinderUpdatedEvent; #[derive(Clone, Resource)] pub(crate) struct FinderRes(Arc); @@ -206,12 +206,12 @@ fn update( fn check_update_result( mut state: ResMut, mut finder_res: ResMut, - mut pf_updated: EventWriter, + mut pf_updated: EventWriter, ) { if let Some(finder) = state.check_result() { info!("Inserting updated path finder"); finder_res.update(finder); - pf_updated.send(PathFinderUpdated); + pf_updated.send(PathFinderUpdatedEvent); } } diff --git a/crates/pathing/src/lib.rs b/crates/pathing/src/lib.rs index 9cfb462c..4fff8164 100644 --- a/crates/pathing/src/lib.rs +++ b/crates/pathing/src/lib.rs @@ -22,7 +22,7 @@ pub use fplugin::create_finder; use fplugin::FinderPlugin; pub use path::ScheduledPath; use pplugin::PathingPlugin; -pub use pplugin::UpdateEntityPath; +pub use pplugin::UpdateEntityPathEvent; pub use query::{PathQueryProps, PathTarget}; pub struct PathingPluginGroup; diff --git a/crates/pathing/src/pplugin.rs b/crates/pathing/src/pplugin.rs index d1c4a12c..2257f1f5 100644 --- a/crates/pathing/src/pplugin.rs +++ b/crates/pathing/src/pplugin.rs @@ -10,7 +10,7 @@ use de_core::{ use futures_lite::future; use crate::{ - fplugin::{FinderRes, FinderSet, PathFinderUpdated}, + fplugin::{FinderRes, FinderSet, PathFinderUpdatedEvent}, path::{Path, ScheduledPath}, PathQueryProps, PathTarget, }; @@ -33,14 +33,14 @@ pub struct PathingPlugin; impl Plugin for PathingPlugin { fn build(&self, app: &mut App) { - app.add_event::() + app.add_event::() .add_system(setup.in_schedule(OnEnter(AppState::InGame))) .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) .add_system( update_existing_paths .in_base_set(GameSet::PreMovement) .run_if(in_state(GameState::Playing)) - .run_if(on_event::()) + .run_if(on_event::()) .in_set(PathingSet::UpdateExistingPaths) .after(FinderSet::UpdateFinder), ) @@ -85,12 +85,12 @@ enum PathingSet { /// This event triggers computation of shortest path to a target and /// replacement / insertion of this path to the entity. -pub struct UpdateEntityPath { +pub struct UpdateEntityPathEvent { entity: Entity, target: PathTarget, } -impl UpdateEntityPath { +impl UpdateEntityPathEvent { /// # Arguments /// /// * `entity` - entity whose path should be updated / inserted. @@ -199,7 +199,7 @@ fn update_requested_paths( mut commands: Commands, finder: Res, mut state: ResMut, - mut events: EventReader, + mut events: EventReader, entities: Query<&Transform, With>, ) { for event in events.iter() {