Remove printlns.

This commit is contained in:
Nolan Darilek 2021-07-28 09:39:10 -05:00
parent 7fe808b2a1
commit 5664f9e646

View File

@ -188,7 +188,6 @@ fn calculate_path(
) { ) {
for (entity, destination, coordinates, shape) in query.iter() { for (entity, destination, coordinates, shape) in query.iter() {
if coordinates.i32() == **destination { if coordinates.i32() == **destination {
println!("Removing path1: {:?}", entity);
commands commands
.entity(entity) .entity(entity)
.remove::<Path>() .remove::<Path>()
@ -204,7 +203,6 @@ fn calculate_path(
let map_clone = map.clone(); let map_clone = map.clone();
let shape_clone = shape.clone(); let shape_clone = shape.clone();
let collider_set: StaticColliderComponentsSet = (&collider_query, &obstructions).into(); let collider_set: StaticColliderComponentsSet = (&collider_query, &obstructions).into();
println!("Spawning pathfinding task for {:?}", entity);
let task = pool.spawn(async move { let task = pool.spawn(async move {
find_path_for_shape( find_path_for_shape(
entity, entity,
@ -221,22 +219,18 @@ fn calculate_path(
.insert(Calculating(task)) .insert(Calculating(task))
.remove::<Path>() .remove::<Path>()
.remove::<NoPath>(); .remove::<NoPath>();
println!("Inserted");
} }
} }
} }
fn poll_tasks(mut commands: Commands, mut query: Query<(Entity, &mut Calculating)>) { fn poll_tasks(mut commands: Commands, mut query: Query<(Entity, &mut Calculating)>) {
for (entity, mut calculating) in query.iter_mut() { for (entity, mut calculating) in query.iter_mut() {
println!("Got a calculating task for {:?}", entity);
if let Some(result) = future::block_on(future::poll_once(&mut **calculating)) { if let Some(result) = future::block_on(future::poll_once(&mut **calculating)) {
println!("Got a result, setting and returning");
if let Some(path) = result { if let Some(path) = result {
commands.entity(entity).insert(path); commands.entity(entity).insert(path);
} else { } else {
commands.entity(entity).insert(NoPath); commands.entity(entity).insert(NoPath);
} }
println!("Removing calculation task");
commands.entity(entity).remove::<Calculating>(); commands.entity(entity).remove::<Calculating>();
} }
} }
@ -286,7 +280,6 @@ fn negotiate_path(
continue; continue;
} }
} else { } else {
println!("Removing path2");
commands.entity(entity).remove::<Path>(); commands.entity(entity).remove::<Path>();
velocity.linvel = Vec2::ZERO.into(); velocity.linvel = Vec2::ZERO.into();
} }
@ -308,7 +301,6 @@ fn negotiate_path(
direction *= **speed; direction *= **speed;
velocity.linvel = direction.into(); velocity.linvel = direction.into();
} else { } else {
println!("Removing path3");
velocity.linvel = Vec2::ZERO.into(); velocity.linvel = Vec2::ZERO.into();
commands commands
.entity(entity) .entity(entity)
@ -323,7 +315,6 @@ fn remove_calculating(
query: Query<Entity, (Changed<Destination>, With<Calculating>)>, query: Query<Entity, (Changed<Destination>, With<Calculating>)>,
) { ) {
for entity in query.iter() { for entity in query.iter() {
println!("Probably shouldn't happen");
commands.entity(entity).remove::<Calculating>(); commands.entity(entity).remove::<Calculating>();
} }
} }