More cleanup.
This commit is contained in:
parent
ae46114f6d
commit
d28dd051e4
|
@ -192,6 +192,7 @@ fn calculate_path(
|
|||
commands
|
||||
.entity(entity)
|
||||
.remove::<Path>()
|
||||
.remove::<NoPath>()
|
||||
.remove::<Calculating>()
|
||||
.remove::<Destination>();
|
||||
continue;
|
||||
|
@ -215,7 +216,11 @@ fn calculate_path(
|
|||
&shape_clone,
|
||||
)
|
||||
});
|
||||
commands.entity(entity).insert(Calculating(task));
|
||||
commands
|
||||
.entity(entity)
|
||||
.insert(Calculating(task))
|
||||
.remove::<Path>()
|
||||
.remove::<NoPath>();
|
||||
println!("Inserted");
|
||||
}
|
||||
}
|
||||
|
@ -326,15 +331,6 @@ fn remove_calculating(
|
|||
}
|
||||
}
|
||||
|
||||
fn remove_no_path(
|
||||
mut commands: Commands,
|
||||
query: Query<Entity, (With<NoPath>, Changed<Destination>)>,
|
||||
) {
|
||||
for entity in query.iter() {
|
||||
commands.entity(entity).remove::<NoPath>();
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PathfindingPlugin;
|
||||
|
||||
impl Plugin for PathfindingPlugin {
|
||||
|
@ -342,7 +338,6 @@ impl Plugin for PathfindingPlugin {
|
|||
app.add_system(calculate_path.system())
|
||||
.add_system(poll_tasks.system())
|
||||
.add_system(negotiate_path.system())
|
||||
.add_system_to_stage(CoreStage::PostUpdate, remove_calculating.system())
|
||||
.add_system(remove_no_path.system());
|
||||
.add_system_to_stage(CoreStage::PostUpdate, remove_calculating.system());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user