From d28dd051e4e3dae5cf7ed6a3787c9eb03403b7fc Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 27 Jul 2021 20:17:36 -0500 Subject: [PATCH] More cleanup. --- src/pathfinding.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/pathfinding.rs b/src/pathfinding.rs index 1cf08a2..67a8e42 100644 --- a/src/pathfinding.rs +++ b/src/pathfinding.rs @@ -192,6 +192,7 @@ fn calculate_path( commands .entity(entity) .remove::() + .remove::() .remove::() .remove::(); continue; @@ -215,7 +216,11 @@ fn calculate_path( &shape_clone, ) }); - commands.entity(entity).insert(Calculating(task)); + commands + .entity(entity) + .insert(Calculating(task)) + .remove::() + .remove::(); println!("Inserted"); } } @@ -326,15 +331,6 @@ fn remove_calculating( } } -fn remove_no_path( - mut commands: Commands, - query: Query, Changed)>, -) { - for entity in query.iter() { - commands.entity(entity).remove::(); - } -} - 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()); } }