Remove calculating task at time of creation to avoid needing a separate system.
This commit is contained in:
parent
3202956719
commit
0f4da55509
|
@ -240,6 +240,7 @@ fn calculate_path(
|
|||
});
|
||||
commands
|
||||
.entity(entity)
|
||||
.remove::<Calculating>()
|
||||
.insert(Calculating(task))
|
||||
.remove::<Path>()
|
||||
.remove::<NoPath>();
|
||||
|
@ -324,15 +325,6 @@ fn negotiate_path(
|
|||
}
|
||||
}
|
||||
|
||||
fn remove_calculating(
|
||||
mut commands: Commands,
|
||||
query: Query<Entity, (Changed<Destination>, With<Calculating>)>,
|
||||
) {
|
||||
for entity in query.iter() {
|
||||
commands.entity(entity).remove::<Calculating>();
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PathfindingPlugin;
|
||||
|
||||
impl Plugin for PathfindingPlugin {
|
||||
|
@ -340,7 +332,6 @@ impl Plugin for PathfindingPlugin {
|
|||
app.add_system(calculate_path)
|
||||
.add_system_to_stage(CoreStage::PostUpdate, remove_destination)
|
||||
.add_system(poll_tasks)
|
||||
.add_system(negotiate_path)
|
||||
.add_system_to_stage(CoreStage::PostUpdate, remove_calculating);
|
||||
.add_system(negotiate_path);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user