Skip to content

Commit

Permalink
Fix event struct type names (#638)
Browse files Browse the repository at this point in the history
So that it is consistent with our coding style guide:
https://github.com/DigitalExtinction/Game/blob/main/CONTRIBUTING.md#coding-style
  • Loading branch information
Indy2222 authored Jul 23, 2023
1 parent 4fdf8e0 commit e83de90
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions crates/behaviour/src/chase.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -127,7 +127,7 @@ fn handle_chase_events(mut commands: Commands, mut events: EventReader<ChaseTarg

fn chase(
mut commands: Commands,
mut path_events: EventWriter<UpdateEntityPath>,
mut path_events: EventWriter<UpdateEntityPathEvent>,
chasing: Query<(
Entity,
&Transform,
Expand All @@ -153,7 +153,7 @@ fn chase(
continue;
}

path_events.send(UpdateEntityPath::new(
path_events.send(UpdateEntityPathEvent::new(
entity,
PathTarget::new(
target_position,
Expand Down
6 changes: 3 additions & 3 deletions crates/construction/src/manufacturing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -426,7 +426,7 @@ fn deliver(
mut commands: Commands,
solids: SolidObjects,
mut deliver_events: EventReader<DeliverEvent>,
mut path_events: EventWriter<UpdateEntityPath>,
mut path_events: EventWriter<UpdateEntityPathEvent>,
factories: Query<(&Transform, &ObjectType, &Player, &DeliveryLocation)>,
) {
for delivery in deliver_events.iter() {
Expand All @@ -451,7 +451,7 @@ fn deliver(
DespawnOnGameExit,
))
.id();
path_events.send(UpdateEntityPath::new(
path_events.send(UpdateEntityPathEvent::new(
unit,
PathTarget::new(
delivery_location.0,
Expand Down
6 changes: 3 additions & 3 deletions crates/controller/src/commands/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -89,13 +89,13 @@ type SelectedMovable = (With<Selected>, With<MovableSolid>);
fn send_selected_system(
mut send_events: EventReader<SendSelectedEvent>,
selected: Query<Entity, SelectedMovable>,
mut path_events: EventWriter<UpdateEntityPath>,
mut path_events: EventWriter<UpdateEntityPathEvent>,
mut chase_events: EventWriter<ChaseTargetEvent>,
) {
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),
));
Expand Down
8 changes: 4 additions & 4 deletions crates/pathing/src/fplugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub struct FinderPlugin;

impl Plugin for FinderPlugin {
fn build(&self, app: &mut App) {
app.add_event::<PathFinderUpdated>()
app.add_event::<PathFinderUpdatedEvent>()
.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)))
Expand Down Expand Up @@ -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<PathFinder>);
Expand Down Expand Up @@ -206,12 +206,12 @@ fn update(
fn check_update_result(
mut state: ResMut<UpdateFinderState>,
mut finder_res: ResMut<FinderRes>,
mut pf_updated: EventWriter<PathFinderUpdated>,
mut pf_updated: EventWriter<PathFinderUpdatedEvent>,
) {
if let Some(finder) = state.check_result() {
info!("Inserting updated path finder");
finder_res.update(finder);
pf_updated.send(PathFinderUpdated);
pf_updated.send(PathFinderUpdatedEvent);
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/pathing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions crates/pathing/src/pplugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand All @@ -33,14 +33,14 @@ pub struct PathingPlugin;

impl Plugin for PathingPlugin {
fn build(&self, app: &mut App) {
app.add_event::<UpdateEntityPath>()
app.add_event::<UpdateEntityPathEvent>()
.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::<PathFinderUpdated>())
.run_if(on_event::<PathFinderUpdatedEvent>())
.in_set(PathingSet::UpdateExistingPaths)
.after(FinderSet::UpdateFinder),
)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -199,7 +199,7 @@ fn update_requested_paths(
mut commands: Commands,
finder: Res<FinderRes>,
mut state: ResMut<UpdatePathsState>,
mut events: EventReader<UpdateEntityPath>,
mut events: EventReader<UpdateEntityPathEvent>,
entities: Query<&Transform, With<MovableSolid>>,
) {
for event in events.iter() {
Expand Down

0 comments on commit e83de90

Please sign in to comment.